Ajax doesn't work on remote server .

Posted by Nuha on Stack Overflow See other posts from Stack Overflow or by Nuha
Published on 2010-06-07T15:15:59Z Indexed on 2010/06/07 15:22 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

Hello .

when I Implemented chatting Function , I use Ajax to send messages between file to another .

so , it is working well on local host .

but , when I upload it in to remote server it doesn't work.

can U tell me ,why ? is an Ajax need Special configuration ?

Ajax code :

   function Ajax_Send(GP,URL,PARAMETERS,RESPONSEFUNCTION){?
var xmlhttp?
try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}?
catch(e){?
try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}?
catch(e){?
try{xmlhttp=new XMLHttpRequest()}?
catch(e){?
alert("Your Browser Does Not Support AJAX")}}}?
?
err=""?
if (GP==undefined) err="GP "?
if (URL==undefined) err +="URL "?
if (PARAMETERS==undefined) err+="PARAMETERS"?
if (err!=""){alert("Missing Identifier(s)\n\n"+err);return false;}?
?
xmlhttp.onreadystatechange=function(){?
if (xmlhttp.readyState == 4){?
if (RESPONSEFUNCTION=="") return false;?
eval(RESPONSEFUNCTION(xmlhttp.responseText))?
}?
}?
?
if (GP=="GET"){?
URL+="?"+PARAMETERS?
xmlhttp.open("GET",URL,true)?
xmlhttp.send(null)?
}?
?
if (GP="POST"){?
PARAMETERS=encodeURI(PARAMETERS)?
xmlhttp.open("POST",URL,true)?
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")?
xmlhttp.setRequestHeader("Content-length",PARAMETERS.length)?
xmlhttp.setRequestHeader("Connection", "close")?
xmlhttp.send(PARAMETERS)?
}?
}

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about configuration