Hi i am getting state 0 error on XMLHTTPRequest. I am using POST method to get some information from a link hosted by the client. I am calling from a mobile application. I have added a html file in an android application and from that html file i am calling post method on the client web link using XMLHTTPRequest object. I got the information from this site that its due to cross domain access issue. And get the html file from the web server to fix this issue. But in my scenario i cannot do this. The html file is embedded in the android application. Can any one help me in clearing this issue. its really become a bottle neck and deadlock for me..

You need one of the following to overcome a cross-domain constraint:

The approaches taken by these solutions are very different.

flxhr is a small flash object (flash has no cross-domain constraint), which implements the same API as a standard XMLHTTPRequest. This works successfully in the major PC-based browsers and may work under Android - I've not tried.

JSON works by delivering json/javascript into a dynamically created <script> node. The jQuery lib, simplifies the use of JSONP.

CORS is completely new to me. I just discovered it when reading Wikipedia's JSONP entry.

In all cases, the server must be equipped to handle cross-domain requests (see "Update Sept. 21, 2011", here) and must deliver a response that can be handled by the chosen method and your response handler. Ultimately, if you don't have control of the server, then you may be snookered.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.