HTML code:
JS code:
If the saving is successful, the background returns {"ok":true}; if the saving fails, the background returns {"ok":false, "msg":"error message"}
function save() {
$("#frm").submit();
$("#fra").one("load", function () {
var data = eval("(" $("#fra").contents().find("body").html() ")");
If (data.ok) {
$("#divtrackroad").load("TrackRoad?roadId="
'@ViewBag.roadId' "&roadName="
'@ViewBag.roadName' "&viewOrEdit=1&t=" new Date().valueOf());
} else {
alert("Save failed: " data.msg);
}
});
}
Isn’t it very simple? If you friends need it, just take it away, you’re welcome^_^