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)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745370877a4624788.html
评论列表(0条)