5

I written a android mobile application in JQuery Mobile and PhoneGap in Eclipse. In the application I am calling a jquery ajax to load list of data from other domain.

My jquery ajax call code is:

$.ajax({
            type: "POST",
            url: WEBSERVICE_URL,
            async: false,
            data: dataString,
            dataType: 'json',
            crossDomain: true,
            success: function(data) {
                loginData = new Object(data);
                hideActivityIndigator();
                if(loginData.success == "true"){
                    $.mobile.changePage("#selectionScreen", "slide", false, true);
                } else {
                    $("#message_ajax").html("Invalid UserName/Password.");
                }
            },
            error: function(xhr, ajaxOptions, thrownError){
                alert(xhr.status);
                alert(thrownError);
                hideActivityIndigator();
            }
        });

The variable "WEBSERVICE_URL" has a other domain php service url. On executing above code on "pageview" event I am getting following error

Error: NETWORK_ERR: XMLHttpRequest Exception 101

Any solution is there to access service from other domain in JQuery Mobile + PhoneGap...?

1
  • 2
    You can't post to cross-domain in JS as far as i remember :( Commented Apr 11, 2012 at 11:30

2 Answers 2

2

I think this might solve your problem.

Sign up to request clarification or add additional context in comments.

Comments

1

If you are using Phonegap/Cordova you should be able to call cross-domain web-services.. are you using an emulator or a phone?

As for emulator I would recommend Ripple, you can add it as a Chrome extension or Download the standalone version

1 Comment

In the Chrome extesion the localhost file access live webservice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.