Zhixian's Tech Blog

2015-02-09

done function not called in jQuery AJAX call

Filed under: development, web application development — Tags: , , — Zhixian @ 23:40:02 pm

In jQuery, you can write an AJAX call that is chained to a done function.
Sometimes this function does not get called.

One of things to examine is the response that you are receiving from the server.
If the response is malformed, the done function will not get triggered.

An example of a malformed response:

{ "result" : OK }

Correct reponse (note the presence of quotation marks around OK:

{ "result" : "OK" }

Advertisements

Blog at WordPress.com.