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-Phon开发者_Python百科eGap-and-XUI
But it isn't clear. How to invoke for example this web method?: http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit
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);
}
});
精彩评论