简体   繁体   English

通过ajax提交表单在Internet Explorer 8中不起作用

[英]submitting form through ajax doesn't work in Internet Explorer 8

When I submit the form using ajax in Internet Explorer, instead of submitting the form, all the variables that are being sent appear in the address bar. 当我在Internet Explorer中使用Ajax提交表单时,而不是提交表单,所有要发送的变量都显示在地址栏中。 Any ideas how to fix this? 任何想法如何解决这一问题?

Here's what appears in the address bar: mypage/home?v1=name&0v=0&v2=&v3= 地址栏中显示的内容如下: mypage/home?v1=name&0v=0&v2=&v3=

Here's the code: 这是代码:

$(".submitF").live(
    "submit", function () {
        var fcontent = $(this).serialize();
        var divs = $(this).attr("data-div");
        divs = divs.split(",");
        $.ajax({
                type: "post",
                url: "core/ajax.php",
                data: "ajax=ajax&divs=" + divs + fcontent,
                beforeSend: function () {
                    centerWin("loading");
                },
                complete: function () {
                    $("#loading").hide("fast");
                },
                success: function (html) {
                    $("#mainWin").html(html).addClass(newClass);
                });
            return false;
        });

I don't think you'd want your: 我认为您不想要您的:

      var divs = $(this).attr("data-div");       
      divs = divs.split(","); 

Inside the ajax method call, move that outside and see if it helps. 在ajax方法调用内部,将其移到外部,看看是否有帮助。

简单明了-您不能在submit使用.live(...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM