[英]XUI library: call web method (cross-domain)
我在這里只找到了一個如何使用xui.js
調用 web 服務的示例: http://wiki.phonegap.com/w/page/32513809/Simple-Web-Service-Consumption-with-PhoneGap-and-XUI
但目前還不清楚。 例如,如何調用此 web 方法?: http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit
我也不熟悉這個。 但是他們的示例看起來您可以通過以下方式調用它:
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);
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.