使用Post时,xmlHTTP请求在FireFox中返回403 [英] xmlHTTP Request returns 403 in FireFox when Post used

查看:99
本文介绍了使用Post时,xmlHTTP请求在FireFox中返回403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前正在从共享主机转换到专用服务器。在旧服务器上运行的

相同代码无法在专用的

服务器上运行。这是一个简单的AJAX请求,如:


< code>

函数createXMLHttpRequest(){

if(window.ActiveXObject ){

xmlHttp = new ActiveXObject(" Microsoft.XMLHTTP");

}

else if(window.XMLHttpRequest){

xmlHttp = new XMLHttpRequest();

}

}

函数doRequestUsingPOST(){

createXMLHttpRequest();

var queryString =" response.php?" ;;

queryString = queryString + createQueryString();

xmlHttp.onreadystatechange = handleStateChange;

xmlHttp.open(" POST",queryString,true);

xmlHttp.send(null);

}

< / code>


使用上面的代码,请求在IE中正常工作。使用Firefox

它会在页面上抛出403。使用

参数调用response.php页面可以在AJAX之外正确运行。更改所有POST请求

来解决问题,但我不想更改

所有POST请求到GET请求。


有没有人知道新服务器上的设置会导致FireFox

(1.5.x和2.0.x)返回带有AJAX后呼叫的403?

解决方案

FMDeveloper写道:


有没有人知道新服务器上的设置可以导致FireFox

(1.5.x和2.0.x)返回带有AJAX后呼叫的403?



服务器发送该HTTP响应状态代码。检查

responseText是否包含禁止请求的详细信息。


-


Martin Honnen http://JavaScript.FAQTs.com/


3月31日凌晨4:39,Martin Honnen< mahotr ... @ yahoo.dewrote:


FMDeveloper写道:


有没有人知道新服务器上的设置可以导致FireFox

(1.5.x和2.0.x)返回403一个AJAX的电话?



服务器发送该HTTP响应状态代码。检查

responseText是否包含禁止请求的详细信息。


-


Martin Honnen http://JavaScript.FAQTs.com/



responseText仅包含来自服务器的403错误消息


FMDeveloper写道:


3月31日凌晨4:39,Martin Honnen< mahotr ... @ yahoo.dewrote:


>> FMDeveloper写道:


>>>有没有人知道新服务器上可能导致FireFox(1.5.x和2.0.x)返回的设置403与AJAX邮局通话?


服务器发送该HTTP响应状态代码。检查
responseText是否包含禁止请求的详细信息。



responseText仅包含来自服务器的403错误消息



然后检查服务器的错误日志。


-

Ian Collins。


Currently transitioning from a shared host to a dedicated server. The
same code that works on the old server is not working on the dedicated
server. It is a simple AJAX request like:

<code>
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function doRequestUsingPOST() {
createXMLHttpRequest();
var queryString = "response.php?";
queryString = queryString + createQueryString() ;
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("POST", queryString, true);
xmlHttp.send(null);
}
</code>

With the code as is above, the requests works fine in IE. With Firefox
it throws a 403 on the page. A call to the response.php page with
parameters runs correctly outside of AJAX. Changing all POST requests
to GET resolves the issue, but I would prefer not to have to change
ALL POST requests to GET requests.

Does anyone know of a setting on the new server that can cause FireFox
(1.5.x and 2.0.x) to return a 403 with an AJAX post call?

解决方案

FMDeveloper wrote:

Does anyone know of a setting on the new server that can cause FireFox
(1.5.x and 2.0.x) to return a 403 with an AJAX post call?

The server sends that HTTP response status code. Check whether
responseText contains details why the request is forbidden.

--

Martin Honnen
http://JavaScript.FAQTs.com/


On Mar 31, 4:39 am, Martin Honnen <mahotr...@yahoo.dewrote:

FMDeveloper wrote:

Does anyone know of a setting on the new server that can cause FireFox
(1.5.x and 2.0.x) to return a 403 with an AJAX post call?


The server sends that HTTP response status code. Check whether
responseText contains details why the request is forbidden.

--

Martin Honnen
http://JavaScript.FAQTs.com/

The responseText only contains the 403 error message from the server


FMDeveloper wrote:

On Mar 31, 4:39 am, Martin Honnen <mahotr...@yahoo.dewrote:

>>FMDeveloper wrote:

>>>Does anyone know of a setting on the new server that can cause FireFox
(1.5.x and 2.0.x) to return a 403 with an AJAX post call?


The server sends that HTTP response status code. Check whether
responseText contains details why the request is forbidden.


The responseText only contains the 403 error message from the server

Then check the server''s error log.

--
Ian Collins.


这篇关于使用Post时,xmlHTTP请求在FireFox中返回403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆