开发者

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);
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜