views:

35

answers:

2

Hi,

Seems like got stuck in the cross domain issue.

Just trying to get the XML response from the servlet call through POST method:

$.ajax({ type: "POST", url: "http://10.210.221.43:9081/shopsfinder/servlet/ ShopsFinderStoreServlet" //THIS DOESN'T //url: "../ShopsFinderStoreServlet" //IT WORKS ..................

It works fine when we place the servlet at the same location where our application server is, with the relative path.

BUT we have to put the servlet somewhere else means [at some other location], due to some limitations.

Then it doesn't hit the servlet and we don't give any response back to the browser and it goes in error function as given:

                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                            alert("errror XMLHttpRequest: " + XMLHttpRequest.responseXML + "textStatus: " + textStatus + "  errorThrown: " +errorThrown);
                            }

Which gives all the values NULL and get the exception in FF.

Do we have any work around to overcome this issue?

Many thanks Mohammed Arif

A: 

Cross Domain Access are initially disabled by most browsers for security reasons. To overcome this issue you must enable Cross Domain Access or perhaps implements Ajax Proxies.

jerjer
A: 

Because of some reason, we couldn't use proxy.

But we have overcome the issue, we have used Open Hub AJAX API which solved cross domain problem, now everything has been working fine.

Mohammed Arif