继续评论:当您似乎不需要 回调时 ,您似乎对它有些痴迷!:)
对现有代码的简单更改是丢弃
cnf并简单地将代码放入ajax调用的成功部分:
$("#form").submit(function (e) { $.ajax({ type: "POST", url: 'page.php', data: $('#form').serialize(), async: true, success: function (responseText) { if (responseText.indexOf('err') != -1) { // Do something when it fails here } else { // Do something when it succeeds here!!!! alert('ok'); // e.g. move on to "step 2" } }, error: function () {// Do something when it fails here } });});


