两个tomcat之间的Ajax调用

I am Calling a jsp(which is in another tomcat) using ajax function.But i am getting any response back ..I placed my code below

This is my ajax function(In tomcatA)

function connect(){
try{
// Firefox, Opera 8.0+, Safari
var xmlHttp=new XMLHttpRequest();
}catch (e){
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
alert(xmlHttp.status);
if(xmlHttp.readyState==4){
}
}
url="http://IP:PORT/List/Get.jsp";
xmlHttp.open("GET",url+"?sid="+Math.random(),true);
xmlHttp.send(null);
}

Below is my Get.jsp(In tomcatB)

<%@page import=" "%>
<%@page import=" "%>
<select>
<%Iterator it = HashMap.keySet().iterator();
while(it.hasNext()){
String key = (String)it.next();
String value = (String)HashMap.get(key);
%>
<option><%= key + " " + value %> </option>
<%}%>

</select>

But if i access the Get.jsp directly from browser its work fine.. i am getting the combo box with data(as i expected).Please help me on this.. i swear URL and all right

onreadystatechange is not closed correctly, change the following code:

xmlHttp.onreadystatechange=function(){
   alert(xmlHttp.status);
   if(xmlHttp.readyState==4){
}

into this:

xmlHttp.onreadystatechange=function(){
    alert(xmlHttp.status);
    if(xmlHttp.readyState==4){
        // do sth
    }
}

JavaScript can only load data from the same host, this is called SameOrginPolicy. In short, this roughly means that a JavaScript Code embedded in a HTML-File on ServerA can only requests documents from ServerA via AJAX. This is done for security reasons.

If you really need to load data from a external server, you can try to use JSONP. Examples can be found via Google, for example here.

Ajax is used between two different tomcats. if we done the below setting

IE-->Tools-->Internet Options-->security-->custom level-->miscellaneous-->Access data source Accross domains-->Enable

this setting should be done in requesting IE side