[英]jQuery AJAX call doesn't execute success block
I have a Javascript function that does an ajax REST call to a spring controller to grab some stuff from a database and plot it on a map. 我有一个Javascript函数,该函数对spring控制器进行ajax REST调用,以从数据库中获取一些内容并将其绘制在地图上。 For some reason the success area of the ajax call isn't executing, but the GET request is returning with a status of 'success'.
由于某种原因,ajax调用的成功区域未执行,但是GET请求返回的状态为“成功”。 Is there any reason why my success block wouldn't execute but the complete block would?
有什么理由为什么我的成功块不会执行,而完整块会执行?
query: 查询:
$j.ajax({
url: url,
type: 'GET',
dataType: 'json',
sucess: function(json) {
console.log("getTestData successful");
boxes = parseJsonForTestData(json);
//console.log(">> boxes = '" + boxes + "' <<");
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("getTestData failed with textStatus '" + textStatus + "' errorThrown '" + errorThrown + "'");
},
complete: function(jqXHR, textStatus){
console.log("getTestData complete textStatus='" + textStatus + "'");
if( boxes.length != 0) {
$j('#results_textfield').text(boxes.length + ' results found');
}
else {
$j('#results_textfield').text(boxes.length + ' result found');
}
}
});
parseJsonForTestData: parseJsonForTestData:
function parseJsonForTestData(json) {
console.log(">> In music.js function parseJsonForTestData <<");
//...abstracted
}
log: 日志:
AJAX call to api/rest/da/getTestData/ music.js (line 310)
GET http://localhost:8080/s2i/api/rest/da/getTestData/
200 OK 39ms jquery-latest.js (line 6054)
getTestData complete textStatus='success'
Note that none of the console.log statements from the success block or parseJsonForTestData appear in the log file. 请注意,成功块或parseJsonForTestData中的console.log语句均未出现在日志文件中。
Any ideas or advice would be helpful. 任何想法或建议都会有所帮助。
you have written sucess:
instead of success:
您已写成
sucess:
不是success:
that's why the code is not executed (and maybe you should have some related error in js console) 这就是为什么不执行代码的原因(也许您应该在js控制台中遇到一些相关的错误)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.