0

为什么ajaxForm 没有在 jQuery 对话框模式确认中运行,只要它包含在“删除项目”按钮中。

这是我的 jquery 对话框:

  <div id="deleteDialogForPartylist" title="Delete this item?">
      <form id="deleteDialogForPartylistForm" action="mEdit/editPartylist/storeDataToDb/deleteData.php">
        <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span><span id="acronymOfTheParty" style="font-weight:bolder"></span> will be permanently deleted and cannot be recovered. Are you sure?</p>
        <input type="hidden" id="deleteDialogForPartylistHiddenId" name="deleteDialogForPartylistHiddenId">
      </form>
  </div>

这是我的脚本

$(function(){
$( "#deleteDialogForPartylist" ).dialog({
  autoOpen: false,
  resizable: false,
  height:225,
  hide: 'fade',
  modal: true,
  buttons: {
    Cancel: function() {
      $("#deleteDialogForPartylist").dialog('close');
    },
    "Delete item": function() {
      $('#deleteDialogForPartylistForm').ajaxForm({
            target: '#partyListInAddCandidate',
            type: "post",
            success: function(){
                alert("Success");
                $("#deleteDialogForPartylist").dialog('close');
            }
        });
    }
  }
});
});
4

1 回答 1

0

.ajaxForm()不提交插件文档所述的表单(http://malsup.com/jquery/form/#api

在您的情况下,您应该.ajaxSubmit()改用它,这将立即提交您的表单,如 charlietfl 的评论所建议的那样

于 2014-03-12T10:54:26.693 回答