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
jqueryajaxpost在IE中失败,在其他浏览器中工作_Jquery_Ajax_Internet Explorer - Fatal编程技术网

jqueryajaxpost在IE中失败,在其他浏览器中工作

jqueryajaxpost在IE中失败,在其他浏览器中工作,jquery,ajax,internet-explorer,Jquery,Ajax,Internet Explorer,我正在使用jQuery/AJAX作为登录表单。以下脚本适用于最新版本的Firefox、Opera和Google Chrome,但在bot IE6和IE9上失败。无论我键入的密码是正确的还是错误的,我的错误函数都会使用“readystate=0,status=0,statusText=“error:Invalid argument.”调用 现在,您已经确定了问题,可以安全地开始调试了。您是否在成功回调中提醒了响应?谢谢Pierre,这解决了问题;)我已经在Google上搜索/编码了一段时间,试图解

我正在使用jQuery/AJAX作为登录表单。以下脚本适用于最新版本的Firefox、Opera和Google Chrome,但在bot IE6和IE9上失败。无论我键入的密码是正确的还是错误的,我的错误函数都会使用“readystate=0,status=0,statusText=“error:Invalid argument.”调用


现在,您已经确定了问题,可以安全地开始调试了。您是否在成功回调中提醒了响应?谢谢Pierre,这解决了问题;)我已经在Google上搜索/编码了一段时间,试图解决这个问题,但当然我在发布Q后发现了问题。如果我删除url参数,它也可以在IE中工作。我是否应该更新我的问题w用这些信息,或者回答我自己的问题?哇@Pierre,这是有史以来最简单、最可靠的拍摄。
$(function() {
  $(document).ready(function(){
    $("form").submit(function(){
      var thistarget = this.target;
      jQuery.ajax({
        data: $(this).serialize(),
        url: this.action,
        type: this.method,
        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
        error: function(xhr, textStatus, errorThrown) {
          if (typeof xhr.responseText !== "undefined") {
            $('strong.message').text(xhr.responseText);
          } else {
            $('strong.message').text("Bad username and/or password");
          }
          $('div.alert').show();
        },
        success: function(response) {
          document.location.href='/';
        }
      });
      return false;
    });
  });
});