为什么以下引发错误?
$.ajax({
type: "GET",
url: str,
crossDomain: true,
timeout: 5000,
success: function(data) {
console.log(data);
},
error: function(error) {
console.log(error.statusText);
},
});
变量str
的值为"http://deepview.info/getTableData.php?uid=5405&exchange=NASDAQ&symbol=MSFT&startDate=1391212800&endDate=1393632000"
我真正需要的是将输出保存到json文件......
答案 0 :(得分:0)
尝试这个
str = "http: //deepview.info/getTableData.php";
formData = {
uid: "5405",
exchange: "NASDAQ",
symbol: "MSFT",
startDate: "1391212800",
endDate: "1393632000"
}
$.ajax({
type: "GET",
url: str,
crossDomain: true,
data: formData,
contentType: 'application/json',
dataType: "json",
success: function(data) {
console.log(data);
},
error: function(response) {
console.log(response);
},
});