【问题标题】:Ajax request reloads page in IE10IE10 中的 Ajax 请求重新加载页面
【发布时间】:2016-05-24 11:19:56
【问题描述】:

我了解到 IE10+ 能够像所有其他浏览器一样正常进行跨域,但在我的情况下似乎不起作用。

当我启动请求时,IE 只是重新加载页面。

ajaxreq = $.ajax({
    postData = {"movie":movie, "season":season};
    url: "/cgi-bin/find_data.py",
        type: "post",
        datatype:"json",
        cache: false,
        async : true,
        data: postData,
        success: function(response){
           var json = $.parseJSON(response);
        }
    })
    .fail(function(err) {
        alert("error" + err);
    });

XDR 也是如此,但只有在我关心 IE

【问题讨论】:

    标签: javascript ajax


    【解决方案1】:

    有两种解决方案:

    1. 将按钮的输入类型从提交更改为按钮
    2. 添加返回假;在 onclick 事件中

    【讨论】:

    • 0。 e.preventDefault(); ... 我可以在您的代码中看到一个按钮或 onclick 监听器。
    猜你喜欢
    • 2012-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-06
    • 2016-04-20
    • 2020-09-07
    • 1970-01-01
    相关资源
    最近更新 更多