Hi,
I've been testing a page on my local machine and part of it passes a very long string (4000+ chars) to a php script. Using GET this fails. However on my local machine POST works. As soon as I upload it to the server it does not work and cannot seem to find the php file. Instead it seems to redirect to the domain root index file.
I do not have an .htaccess file in the directory where I am running this page from and I have commented out all entries in my root .htaccess.
See the code below - in this case I have simplifed it to only be posting a very short parameter but it does the same thing.
Code:
loadXMLDocTEST("saveRouteTEST.php");
function loadXMLDocTEST(url) {
xmlhttp=null;
if (window.XMLHttpRequest) {// code for all new browsers
xmlhttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {// code for IE5 and IE6
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp != null) {
var params = "route1=sd";
xmlhttp.onreadystatechange = callBackTEST;
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);
}
else {
alert("Your browser does not support XMLHTTP.");
}
}
function callBackTEST() {
if (xmlhttp.readyState==4) {// 4 = "loaded"
if (xmlhttp.status==200) {// 200 = OK
//alert(xmlhttp.responseText);
alert(xmlhttp.responseText);
}
else {
alert("Problem retrieving XML data");
}
}
}
I can run a very similar script which uses GET and it works fine and finds my php file with no problems so to me it seems there is an issue with the POST.
Anyone got any ideas? Is POST blocked by the servers?
Thanks,
Mudders