weixin_33733810 2014-01-30 15:02 采纳率: 0%
浏览 105

如何使用AJAX提交表单?

我将Ajax与JQUERY一起使用以提交表单。

由于某种原因,我似乎无法运行AJAX。该表格位于fancybox 2模式中,因此我认为可能与该表格有关,但我无法弄清楚。对于在fancybox模式中进行AJAX调用,我需要做些特定的事情吗?

我的代码:collection_create_input是TRUE。

$(".edit-post").submit(function(e) {

    var dataString = $(this).serialize();


if (collection_create_input == "true") {
    $.ajax({  
        type: "POST",  
        url: "checkcollection.php",  
        data: dataString,
        async: false,
        success: function(data) {
          $(this).parent(".modal-content").find("#field1secondary").show();
        }
    });
}

        e.preventDefault();

    });

NOTE:

  • 写回答

6条回答 默认 最新

  • local-host 2014-01-30 15:04
    关注

    Are you making sure also to include the jQuery library?

    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    

    If you are using ajax in this way, you have to include it, else it won't run.

    评论

报告相同问题?