Jump to content

Ajax url problem ............


pankaj.ghadge

Recommended Posts

how to specify url of ajax.I have given full path still it is not working.......Php page is in different directory ...............I have created a plugins directory. in that i have created a ajax_table_load.phpand i am sending request to that php page from from another directory. which is outside of that plugins directory. I think problem is with url variable that i have declared below. I want to specify a complete path . please guide me.......................

<script>     var  xmlHttp;function quit(){    xmlHttp=GetXmlHttpObject();if (xmlHttp==null)  {        alert ("Browser does not support HTTP Request");        return;  }        var url="http://"+document.domain+"/plugins/ajax_table_load.php";        xmlHttp.onreadystatechange=stateChanged;        xmlHttp.open("GET",url,true);        xmlHttp.send(null);}function GetXmlHttpObject(){        var xmlHttp=null;        try         {                 // Firefox, Opera 8.0+, Safari                 xmlHttp=new XMLHttpRequest();         }         catch (e)         {                 //Internet Explorer                 try                  {                          xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");                  }                 catch (e)                  {                          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");                  }         }                        return xmlHttp;}function stateChanged(){         if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")         {                alert(xmlHttp.responseText);                //document.getElementById(divStr).innerHTML=xmlHttp.responseText;                //alert(document.getElementById(divStr).innerHTML);         }}</script>  

Link to comment
Share on other sites

Browsers forbid cross-domain AJAX requests, and they do this by restricting the URL to a local one - i.e. forbidding the domain part. Try using this URL instead; it means exactly the same thing as the one you posted above (because a leading slash means the document root):

/plugins/ajax_table_load.php

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...