This article mainly introduces how to use ajax without refreshing new forms. For more information, see the following HTML code:
JS Code:
If the storage is successful, {"OK": true} is returned in the background. If the storage fails, {"OK": false, "msg": "error message"} is returned in the background "}
Function save () {$ ("# frm "). submit (); $ ("# fra "). one ("load", function () {var data = eval ("(" + $ ("# fra "). contents (). find ("body" ).html () + ")"); if (data. OK) {$ ("# ptrackroad "). load ("TrackRoad? RoadId = "+ '@ ViewBag. roadId '+ "& roadName =" +' @ ViewBag. roadName '+ "& viewOrEdit = 1 & t =" + new Date (). valueOf ();} else {alert ("failed to save:" + data. msg );}});}
Isn't it very easy? If your friends need it, take it directly. Thank you!
For more articles related to form submission without refreshing Using ajax, refer to PHP!