Jquery .ajax Call Never Calling Method
In this SO post I learned how to get a return value from an AJAX call: function CallIsDataReady(input) { $.ajax({ url: 'http://www.blah.com/services/Tes
Solution 1:
It is always a good idea to include an error handler function as one of the options passed to $.ajax. For example, add this code after your success functions:
,
error: function(jqXHR, textStatus, errThrown) {
console.log("AJAX call failed");
console.log(errThrown);
}
That will log at least a bit of information if the $.ajax call doesn't succeed.
EDIT
According to your comment, this logs
SyntaxError: Invalid character
And in fact, I now see that you are giving a plain JavaScript object as the data
option passed to $.ajax, but indicating that it is a JSON object in the dataType
field. You need to actually convert the input object into JSON yourself, like so:
data: JSON.stringify(input),
dataType: 'json',
Alternatively, you could simply format input
as a JSON object in first place, like so:
var input = { "requestGUID": "<%=guid %>" };
The quotes around the field name requestGUID
are sufficient, in this case, to give you a JSON object.
Post a Comment for "Jquery .ajax Call Never Calling Method"