在jquery中调用ajax文件时遇到麻烦

时间:2015-02-25 09:26:47

标签: php jquery ajax

以下编码适用于Chrome浏览器,但不适用于mozilla。如何在mozilla firefox中解决这个问题。

$(document).ready(function() {

   $("#del_enquiry").click(function() {

        var enquiry = new Array();
            $('input[name="del_enq"]:checked').each(function() {
            enquiry.push(this.value);
        });
        if(confirm("Do you want to delete the Records"))
        {
            var delid="deleteid="+enquiry;
            $.ajax({
                 url: "delete_enquiry.php",
                 type: "POST",
                 data: delid,
                 cache: false,
                 success: function(data) {
                        if(data==1) { 
                           alert("Record Deleted Successfully"); 
                        } else { 
                           alert("Record not Deleted"); 
                       }
                }
            });
        }
    });
}); 

1 个答案:

答案 0 :(得分:0)

在提交表单之前,您可以使用表单标记功能的onsubmit atttribue。      在我的函数内写下你的确认框条件。     if(确认(“你想删除吗?”))     {         返回true;     }