The reason why Jquery Post does not enter the callback and the solution, jquery callback
Today, I made a simple addition of data. I uploaded the Json data to the Jsp background using the Post method of Jquery, but I didn't go into the callback function after processing it,
$. Post ("addGs. do "," x = "+ JSON. stringify (x), function (d) {alert ('success') ;}, "json ");
Through FF debugging, it is found that the returned data is normal, 200Ok,
No way. Let's look at Jquery API. If the final parameter is Json, the returned data must be in Json format,
Is the returned Json not standard?
Note that Json usually requires double quotation marks for both Key and Value,
Change code now
Try {d. add (gs); out. println ("{\" s \ ": \" OK \ "}");} catch (Exception e) {out. println ("{\" s \ ": \" err \ "}"); e. printStackTrace ();}
This time finally succeeded.
In Json mode, the Post method must be in strict Json format to enter the callback. If the Text method is used, there is no such requirement.
Thank you for the callback function of JQuery's post method.
No.
No callback will be performed unless you do not go in.
Send it to me
Jquery post method callback function not executed
$. Post ('ershou/login! Login. action', {'petname': username, 'Password': password}, function (data) {alert (data );})
In this way ~ The format is
$. Post (url, {parameter list}, function (){})