Jam*_*son 0 javascript ajax jquery json
我得到'错误'几乎无论我想在jquery的ajax方法中使用dataType'jsonp'加载,但是使用'json'对于相同的json内容工作正常.我需要使用jsonp因为我正在调用外部API来使用.
Js方法:
$.ajax({
url: 'test3.json',
type: 'GET',
dataType: 'json',
data: {
action: 'APICALL',
ID: '59'
},
success: function(data, textStatus, xhr) {
console.log('success');
},
error: function(data, textStatus, xhr) {
console.log('error: '+textStatus);
console.log(data);
},
complete: function(data, textStatus, xhr) {
console.log('complete');
}
});
})
Run Code Online (Sandbox Code Playgroud)
test3.json文件:
{"symbol": "IBM", "price": "91.42"}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
155 次 |
| 最近记录: |