admin管理员组文章数量:1422461
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. For some reason the success area of the ajax call isn't executing, but the GET request is returning with a status of 'success'. Is there any reason why my success block wouldn't execute but the plete 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 + "'");
},
plete: function(jqXHR, textStatus){
console.log("getTestData plete textStatus='" + textStatus + "'");
if( boxes.length != 0) {
$j('#results_textfield').text(boxes.length + ' results found');
}
else {
$j('#results_textfield').text(boxes.length + ' result found');
}
}
});
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 plete textStatus='success'
Note that none of the console.log statements from the success block or parseJsonForTestData appear in the log file.
Any ideas or advice would be helpful.
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. For some reason the success area of the ajax call isn't executing, but the GET request is returning with a status of 'success'. Is there any reason why my success block wouldn't execute but the plete 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 + "'");
},
plete: function(jqXHR, textStatus){
console.log("getTestData plete textStatus='" + textStatus + "'");
if( boxes.length != 0) {
$j('#results_textfield').text(boxes.length + ' results found');
}
else {
$j('#results_textfield').text(boxes.length + ' result found');
}
}
});
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 plete textStatus='success'
Note that none of the console.log statements from the success block or parseJsonForTestData appear in the log file.
Any ideas or advice would be helpful.
Share Improve this question asked Jun 4, 2012 at 15:43 Hunter McMillenHunter McMillen 61.6k25 gold badges124 silver badges176 bronze badges1 Answer
Reset to default 8you have written sucess:
instead of success:
that's why the code is not executed (and maybe you should have some related error in js console)
本文标签: javascriptjQuery AJAX call doesn39t execute success blockStack Overflow
版权声明:本文标题:javascript - jQuery AJAX call doesn't execute success block - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745370877a2655724.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论