IE中的登录问题

时间:2014-01-10 07:10:45

标签: jquery asp.net internet-explorer asp.net-mvc-4

我已经在服务器中托管了我的asp.net mvc 4应用程序,该应用程序在chrome,mozilla中运行良好,但它在IE 10和IE 11中不起作用。此外,当我在调试模式下运行时,应用程序可以正常使用IE。这里我的登录方法包含一个ajax调用。 我的ajax电话是这样的

$.ajax({
   url: window.contexthttproot + "/Report/ReportLocation",
   type: 'POST',
   datatype: "json",
   contentType: "application/json; charset=utf-8",
   cache: false,
   data: json,
   success: function (items) {
              window.location.replace("/LandingPage/Landing");
              setTimeout(function () {
              $('#spinner').fadeOut(35000);
             })
            },
            error: function (xhr, status) {

            }

   });

ajax调用有问题吗?

3 个答案:

答案 0 :(得分:0)

也许是因为:

datatype: "json"

应该是:

dataType: "json"

这是区分大小写的。

答案 1 :(得分:0)

我认为window.location.replace不适用于IE

试试这个

window.location.href = '/LandingPage/Landing';

答案 2 :(得分:0)

您的代码中存在一些问题,原因可能是:

window.location.replace("/LandingPage/Landing");
setTimeout(function () {
    $('#spinner').fadeOut(35000);
})
  • replace()函数有两个参数,你用一个参数调用它。
  • setTimeout()需要时间作为参数传递。延迟参数是必需的,但没有它(在firefox中)它不会给出错误(甚至是严格的警告)。

将其更改为:

    setTimeout(function(){alert("Hello")},3000);