【问题标题】:HTTP: 405 error in IE only. using AjaxHTTP:仅在 IE 中出现 405 错误。使用 Ajax
【发布时间】:2012-02-18 01:22:57
【问题描述】:

您好,我一直在尝试解决我在使用 IE 时遇到的问题

 $.ajaxSetup({
      cache: false
 });

 var dataString = 'firstname=' + firstname + '&lastname=' + lastname + '&areacode=' +      areacode + '&phonenumber=' + phonenumber + '&emailaddress=' + emailaddress + '&confirmemail=' + confirmemail + '&password=' + password + '&streetaddress=' + streetaddress + '&streetaddress2=' + streetaddress2 + '&city=' + city + '&state=' + state + '&zipcode=' + zipcode + '&month=' + month + '&day=' + day + '&year=' + year + '&services=' + services + '&agreement=' + agreement; 
  //alert(dataString); 
 // alert(services); 
 //var d = new Date(); 
  $.ajax({
      cache: false, 
         type: "POST",
        url: "http://www.vectorcreditsolutions.com/js/process.php",
        data: dataString,
  //  dataType: ($.browser.msie) ? "text" : "xml",  
    success: function(ret) {
        window.location.href ="http://www.vectorcreditsolutions.com/thankyou.html";
    }
    });
    return false;
     });

我遇到了 IE 的 http 405 问题,请任何输入都会有所帮助 谢谢你

【问题讨论】:

  • 您必须使用完整的网址吗?脚本是否在不同的域上运行?
  • 重复 (stackoverflow.com/questions/6523162/…) 您不能使用标准 ajax 进行跨域请求
  • 如果将方法切换为 GET 是否有效?另外,你用的是什么版本的IE? (IE6 有几个已知问题)。
  • @pastor:问题表明 Chrome 和 Firefox 中一切正常,因此跨域权限问题似乎不太可能,尽管代码将受益于相对路径 (/js/process.php)
  • 405 错误可能表明您需要使用“GET”请求而不是“POST”——您尝试过吗?

标签: php jquery ajax http


【解决方案1】:

您的参数格式似乎不寻常,我会避免使用 & 作为发布请求

试试这个

   data: { 
        'firstname': firstname, 
        'lastname': lastname,
         .....
    }

【讨论】:

  • 不确定这是否是答案,但对我来说似乎是合理的。
猜你喜欢
  • 1970-01-01
  • 2022-07-14
  • 2014-11-20
  • 1970-01-01
  • 2022-08-16
  • 2021-09-05
  • 2017-09-09
  • 2017-11-20
  • 1970-01-01
相关资源
最近更新 更多