Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax在jQuery移动弹出窗口中不起作用_Jquery_Ajax_Mobile_Popup - Fatal编程技术网

Ajax在jQuery移动弹出窗口中不起作用

Ajax在jQuery移动弹出窗口中不起作用,jquery,ajax,mobile,popup,Jquery,Ajax,Mobile,Popup,我使用jQuery移动弹出窗口作为编辑表单。当用户单击submit按钮时,它应该获取表单上的信息并执行SQL查询以更新数据库。出于某种原因,一旦到达ajax调用,它就会中断。我尝试过使用一个普通的提交按钮,也只是一个绑定到jQuery函数的普通按钮,两者都做同样的事情 $('form').submit(function(event) { event.preventDefault(); alert("checkpoint 1"); $.ajax( { typ

我使用jQuery移动弹出窗口作为编辑表单。当用户单击submit按钮时,它应该获取表单上的信息并执行SQL查询以更新数据库。出于某种原因,一旦到达ajax调用,它就会中断。我尝试过使用一个普通的提交按钮,也只是一个绑定到jQuery函数的普通按钮,两者都做同样的事情

$('form').submit(function(event) {
    event.preventDefault();
    alert("checkpoint 1");
    $.ajax( {
        type: 'POST',
        url: process_edit.php,
        data: $(this).serialize(),
        success: function(data) {
            //do something
        }
    } );
    alert("checkpoint 2");
});

我让“checkpoint 1”警报框出现,但随后jQuery mobile弹出窗口关闭,“checkpoint 2”从未出现。

有一个打字错误,您错过了
url
部分周围的单引号

$('form').submit(function(event) {
    event.preventDefault();
    alert("checkpoint 1");
    $.ajax({
        type: 'POST',
        url: 'process_edit.php',
        data: $(this).serialize(),
        success: function(data) {
            //do something
        }
    });
    alert("checkpoint 2");
});

控制台中是否有错误?@MikeBrant no,没有错误。请尝试添加
.fail(函数(xhr,textStatus,errorhorn)
和/或
。error(函数(xhr,textStatus,errorhorn)
,然后查看是否有错误抛出