AngularJS 用 $http.jsonp 方法跨域請求資料錯誤的問題
function test11($scope,$http)
{
$http.jsonp("https://api.github.com/repos/cs1707/blog/posts?callback=JSON_CALLBACK")
.success(
function(data)
{
console.log(JSON.stringify(data));
});
}
);
為什麼下列json是ok.
{"meta":{"X-RateLimit-Limit":"60","X-RateLimit-Remaining":"46","X-RateLimit-Reset":"1437389126","X-GitHub-Media-Type":"github.v3","status":404},"data":{"message":"Not Found","documentation_url":"https://developer.github.com/v3"}} 。但是返回
{"result":true,"message":[{"task_id":1,"task_name":"nameq","task_description":"sjdfhd","operatename":"x-man","create_time":1433217515000,"update_time":1433670943000,"is_delete":1,"ETL_email":"[email protected]"}]} 就報錯 Uncaught SyntaxError: Unexpected token
:
需要進一步探究