Eladerezador
Eladerezador

Reputation: 1301

IBM MobileFirst - Call WS REST created with IBM RAD

I have an application in MobileFirst, and use an ajax function to call REST WS created with IBM RAD, this is the AJAX function:

$.ajax({
    type: "GET",
    url: "http://localhost:9080/myproject/rest/helloworld/",
    contentType: "text/plain",
    async: false,
    success: function (response) {
            var sHelloWorld = response;
            $("#prueba").empty();
            $("#prueba").append(sHelloWorld); 
    },
    error: function (result) {
        alert('ERROR ' + result.status + ' ' + result.statusText);
    }
});

But I get error

"Access Denied result.status = 0"

Could you be related to this article? Is it possible to specify a port in a ajax call

Upvotes: 0

Views: 105

Answers (1)

Idan Adar
Idan Adar

Reputation: 44516

Since you have likely created a mobile web app (Android, iOS, etc...), note that you're pointing to localhost. That means that your AJAX request is pointing to the device and not to an actual destination.

Replace "localhost" with the IP address of the backend you are attempting to connect to.

Upvotes: 1

Related Questions