【问题标题】:XUI library: call web method (cross-domain)XUI库:调用web方法(跨域)
【发布时间】:2011-07-10 18:42:03
【问题描述】:
【问题讨论】:
标签:
javascript
web-services
cross-domain
cordova
xui
【解决方案1】:
我也不熟悉这个。但他们的例子看起来你可以用以下方式调用它:
x$('#element_id).xhr('http://www.w3schools.com/webservices/tempconvert.asmx/CelsiusToFahrenheit', {
async: true,
method: 'post',
callback: function() {
alert("The response is " + this.responseText);
}
});
因为您需要将摄氏度数据发送到 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);
}
});