1
我想使用JSONP在訪問數據:爲什麼不調用JSONP回調函數?
https://github.com/users/jbranchaud/contributions_calendar_data
然而,沒有我曾嘗試都導致無論是在回調或成功功能的解決方案得到調用。當我使用Chrome/Firefox檢測工具時,我可以查看腳本並看到響應爲200 Ok,並且響應文本包含上述URL中的數據。儘管如此,在任何時候,回調函數和成功函數都不會被調用。關於如何使這個工作的任何想法?
這是我最近在得到嘗試此運行:
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function parseResults(results) {
console.log('hello function callback.');
}
$.ajax({
url: 'https://github.com/users/jbranchaud/contributions_calendar_data',
type: 'post',
dataType: 'jsonp',
jsonp: true,
jsonpCallback: 'parseResults',
success: function(data, textStatus, jqXHR) {
console.log('success_function');
console.log(data);
},
error: function() {
console.log('error with jsonp request');
}
});
</script>
當我加載網頁,我看到在控制檯「與JSONP請求錯誤」,所以有錯誤與AJAX請求。爲什麼這個請求沒有成功的想法?
有任何錯誤控制檯,可以添加一個錯誤回調,並檢查其是否獲取調用parseResults – 2013-03-02 05:02:16
是否獲取調用 – 2013-03-02 05:04:20
有在控制檯中沒有錯誤,但是當我向ajax請求添加錯誤回調時,它打印了我的錯誤消息(請參閱更新的代碼) – jbranchaud 2013-03-02 05:05:35