【发布时间】:2012-11-23 13:22:51
【问题描述】:
我一直在努力使用 Picasa API 上的 POST。 代码如下:
$.ajax({
type: "POST",
url: 'https://picasaweb.google.com/data/feed/api/user/' + uid + '/albumid/' + album_id + '/photoid/' + photo_id,
crossDomain: true,
data: { content: content },
success: function() { alert("Success"); },
error: function() { alert('Failed!'); }
});
我已经通过 GET 毫无问题地检索到了一些信息。
现在有趣的部分来了,当我尝试使用 Google 测试服务时,会出现此错误:
XMLHttpRequest cannot load
https://picasaweb.google.com/data/feed/api/user/userid/albumid/albumid/photoid/photoid?content=foo%bar.
Origin http://localhost:3000 is not allowed by
Access-Control-Allow-Origin
.
当我在 Firefox 中尝试时,请求标头方法更改为OPTIONS,状态为204: no content。
另外,我尝试将datatype 更改为jsonp,但随后HTTP 方法更改为GET 并检索有关图片的信息。
【问题讨论】:
-
您找到解决方案了吗?