Eli Blokh
Eli Blokh

Reputation: 12293

XUI library: call web method (cross-domain)

I found only one example how to use xui.js to call web service here: http://wiki.phonegap.com/w/page/32513809/Simple-Web-Service-Consumption-with-PhoneGap-and-XUI

But it isn't clear. How to invoke for example this web method?: http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit

Upvotes: 0

Views: 1027

Answers (1)

HungryCoder
HungryCoder

Reputation: 7616

I am also not familiar with this. but their example looks like you may call it in the following way:

x$('#element_id).xhr('http://www.w3schools.com/webservices/tempconvert.asmx/CelsiusToFahrenheit', {
    async: true,
    method: 'post',
    callback: function() {
        alert("The response is " + this.responseText);
    }
});

as you will need to send Celsius data to the API:

x$('#element_id).xhr('http://www.w3schools.com/webservices/tempconvert.asmx/CelsiusToFahrenheit', {
    async: true,
    data: 'Celsius=40',
    method: 'post',
    callback: function() {
        alert("The response is " + this.responseText);
    }
});

Upvotes: 0

Related Questions