我在我的網站上運行此代碼以獲取集合上的照片,但我總是最終得到錯誤。控制檯日誌顯示「parsererror」。我究竟做錯了什麼?無法通過jQuery調用flickr api
middle.php
<?php die(file_get_contents($_REQUEST['url'])); ?>
的script.js
//Flickr
var url = encodeURIComponent('http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=1408bff5f72a4b84b924d13e8562b6a2&[email protected]&photoset_id=72157629903184261&format=json');
$.ajax({
url: "middle.php?url="+url,
dataType: "json",
success: function(){
console.log("yes");
},
error: function(jqXHR, textstatus, errorThrown){
console.log("nooo");
console.log(textstatus);
}
});
此代碼看起來潔淨。也許你的代碼中有其他地方出現錯誤? – Dutchie432 2012-04-27 12:55:10
[同源](http://en.wikipedia.org/wiki/Same_origin_policy)? – prodigitalson 2012-04-27 12:55:16
增加了一箇中間人技術 – 2012-04-27 13:58:54