2012-11-22 1 views
0

Picasa API에서 POST로 어려움을 겪었습니다. 이미 문제없이 GET을 통해 몇 가지 정보를 검색 한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!'); } 
}); 

: 여기에 코드입니다.

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입니다.
또한 datatypejsonp으로 변경하려고 시도했지만 HTTP 메서드가 GET으로 변경되고 그림에 대한 정보가 검색됩니다.

+0

해결책을 찾으십니까? –

답변

1

Access-Control-Allow-Origin 귀하의 현재 도메인과 다른 서버에 대해 ajax 호출을하고 있기 때문에오고 있습니다. 당신은 단지 jsonpGET 요청을 할 수 있기 때문에 읽기 더

jsonpherePOST 요청에 대해 도움이되지 않습니다.

IMHO 클라이언트 쪽 스크립트 대신 서버 쪽에서 POST 요청을 만들어야합니다.