I cannot get response from other servers

  • Thread starter balakrishnan.dinesh
  • Start date
B

balakrishnan.dinesh

Hi frends & collins,
The code below is the one Im using now for xmlhttp request
in IE as well as Netscape browser.I have put this code in a server,if i
want to retrive the data from the same server ,then its working fine in
both IE & NN browser .
My problem is, If i want to retrive the data from other servers
which this code is not present there, then its not working.

for example: Im having two servers , servernames : sever1 & server2
if i putting the code below in sevr1 , and i request a
page or any data from servr1 mean its working and im getting the
response.
But i give the request to get some data from servr2
mean its not working.
it showing the error called "Permission denied"

So plz give some suggestion or correct my code to work for retriving
the data from other servers

<html>
<script>
var xmlhttp;
function SubmitthroXML(url) /* Used to get the Response through
XmlHttp */
{
if (window.XMLHttpRequest)
{

xmlhttp=new XMLHttpRequest();

// alert(xmlhttp);
//alert("state "+state_Change());

xmlhttp.onreadystatechange=state_Change()

//alert("ready "+xmlhttp.onreadystatechange)

xmlhttp.open("GET",url,true);


//alert("inside"+xmlhttp.open("GET",url,true));

xmlhttp.send(null)
}

/* code for IE */
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp)
{
alert();

xmlhttp.onreadystatechange=state_Change
xmlhttp.open("GET",url,true)
xmlhttp.send()
}
}
}

function state_Change()
{
alert("ready state "+xmlhttp.readyState);


/* if xmlhttp shows "loaded" */
if (xmlhttp.readyState==4)
{
alert("status "+xmlhttp.status);
/* if "OK" */
if (xmlhttp.status==200)
{
CrossDomainPage = xmlhttp.responseText;

if (CrossDomainPage == " ")
{
alert("Taexpert Server is Down!!Please Wait");
return null;
}


//If needed use this piece of code
document.getElementById('idname').innerHTML =
CrossDomainPage;

}
else
{
alert(xmlhttp.status+"Problem retrieving data:")
}
}

}
</script>
<body onload=SubmitthroXML('http://192.168.1.87/bank/index.htm');>
<div id="idname"></div>
</body>
</html>
 
I

Ian Collins

Hi frends & collins,
The code below is the one Im using now for xmlhttp request
in IE as well as Netscape browser.I have put this code in a server,if i
want to retrive the data from the same server ,then its working fine in
both IE & NN browser .
My problem is, If i want to retrive the data from other servers
which this code is not present there, then its not working.

for example: Im having two servers , servernames : sever1 & server2
if i putting the code below in sevr1 , and i request a
page or any data from servr1 mean its working and im getting the
response.
But i give the request to get some data from servr2
mean its not working.
it showing the error called "Permission denied"

So plz give some suggestion or correct my code to work for retriving
the data from other servers
plz?

You can't. It's a security feature, you can't access data form one
domain from a page served from another.
 
W

Walton

to access cross-domain pages, you need some sort of proxy. this can be
done in php or java or whatever else you can think of to use. i prefer
java. i write a little servlet that calls any webpage and streams back
the data. then you just map the servlet's path to somewhere on your
domain and call it with ajax.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top