在Piacasa API上发表评论 [英] POST comments on Piacasa API
问题描述
我一直在Picasa API的POST上苦苦挣扎.
此处的代码
i''v been struggling with POST on Picasa API.
Here''s code
$.ajax({
type: "POST",
url: 'https://picasaweb.google.com/data/feed/api/user/' + uid + '/albumid/' + album_id + '/photoid/' + photo_id + '?content=' + content,
crossDomain: true,
data: { content: content },
success: function() { alert("Success"); },
error: function() { alert('Failed!'); }
});
我已经通过GET检索了一些信息,没有任何问题.现在,当我尝试在Chrome中发布帖子时,出现了此错误
XMLHttpRequest无法加载https://picasaweb.google.com/data/feed/api/user/jasenko.hadziomeragic@gmail.com/albumid/5623228006440615615505/photoid/5813338978197482482?content=%20dsad%20sa%20d. Access-Control-Allow-Origin不允许使用原始http://localhost:3000.
当我在请求标题中尝试使用Firefox时,方法更改为OPTIONS,状态为204:无内容.另外,我尝试将数据类型更改为jsonp,但随后将http方法更改为GET.
I''ve already retrieved some informations via GET without problems. Now when i try to do post in chrome i got this error
XMLHttpRequest cannot load https://picasaweb.google.com/data/feed/api/user/jasenko.hadziomeragic@gmail.com/albumid/5623228006440615505/photoid/5813338978197482482?content=%20dsad%20sa%20d. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
And when i try in firefox in request header method is changed to OPTIONS and status is 204: no content. Also, I''ve tried to change datatype to jsonp but then http method chages to GET.
推荐答案
.ajax({ 类型:" , 网址:' https://picasaweb.google.com/data/feed/api/user/' + uid + ' /albumid/' + album_id + ' /photoid/' + photo_id + ' ?content =' +内容, crossDomain: true , 数据:{内容:内容}, 成功:功能(){alert(" ); }, 错误:功能(){警报(' 失败! ); } });
.ajax({ type: "POST", url: 'https://picasaweb.google.com/data/feed/api/user/' + uid + '/albumid/' + album_id + '/photoid/' + photo_id + '?content=' + content, crossDomain: true, data: { content: content }, success: function() { alert("Success"); }, error: function() { alert('Failed!'); } });
我已经通过GET检索了一些信息,没有任何问题.现在,当我尝试在Chrome中发布帖子时,出现了此错误
XMLHttpRequest无法加载https://picasaweb.google.com/data/feed/api/user/jasenko.hadziomeragic@gmail.com/albumid/5623228006440615615505/photoid/5813338978197482482?content=%20dsad%20sa%20d. Access-Control-Allow-Origin不允许使用原始http://localhost:3000.
当我在请求标题中尝试使用Firefox时,方法更改为OPTIONS,状态为204:无内容.另外,我尝试将数据类型更改为jsonp,但随后将http方法更改为GET.
I''ve already retrieved some informations via GET without problems. Now when i try to do post in chrome i got this error
XMLHttpRequest cannot load https://picasaweb.google.com/data/feed/api/user/jasenko.hadziomeragic@gmail.com/albumid/5623228006440615505/photoid/5813338978197482482?content=%20dsad%20sa%20d. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
And when i try in firefox in request header method is changed to OPTIONS and status is 204: no content. Also, I''ve tried to change datatype to jsonp but then http method chages to GET.
这篇关于在Piacasa API上发表评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!