my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes Ajax cross domain problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Ajax cross domain problem" Watch "Ajax cross domain problem" New topic

Ajax cross domain problem

Li Xin
Ranch Hand

Joined: Feb 06, 2004
Posts: 37
Does any one know if Ajax request can be sent to another server in the same machine? I have Tomcat and IIS on the same pc, I tried to send Ajax request from JSP in Tomcat to a PHP in IIS, it seems does not work.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Machine does not matter. The domain has to be the same.

Wyatt Matthews

Joined: Aug 31, 2006
Posts: 3
You could consider submitting a request to the IIS server from the Tomcat server, and then when the Tomcat server recieves the response from IIS, return the response from the Tomcat instance. In doing this, you are not asking the client/browser to make the cross domain connection (which is not possible for good reason), you are allowing the server to handle the cross domain issues for you.

Good luck.
I agree. Here's the link:
subject: Ajax cross domain problem
jQuery in Action, 3rd edition