[英]Should I use jQuery Ajax api in jQueryMobile?
我想提出一個移動Web應用程序,使用HTML5,CSS3,JavaScript和jQueryMobile與扭曲它Phonegap
。
我是所有網絡新手,我想知道,當我使用jQueryMobile進行UI時,我可以使用jQuery api進行Ajax調用,還是jQueryMobile擁有自己的工具。
我需要使用Ajax,與外部Web服務進行交互,我將從數據庫中獲取(獲取)和更新(獲取/發布)。
換句話說,jQueryMobile是否支持所有jQuery api,或者我還要在我的應用程序中單獨包含jQuery。
使用jQuery
/ jQuery Mobile
創建AJAX
調用時,jQuery函數$.ajax
是標准的。
工作jsFiddle
示例: http : //jsfiddle.net/Gajotres/jLdFj/
$('#index').live('pagebeforeshow',function(e,data){
$.ajax({url: "http://api.themoviedb.org/2.1/Movie.search/en/json/23afca60ebf72f8d88cdcae2c4f31866/The Goonies",
dataType: "jsonp",
jsonpCallback: 'successCallback',
async: true,
beforeSend: function() {
$.mobile.showPageLoadingMsg(true);
},
complete: function() {
$.mobile.hidePageLoadingMsg();
},
success: function (result) {
ajax.parseJSONP(result);
},
error: function (request,error) {
alert('Network error has occurred please try again!');
}
});
});
幾件事情要考慮:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.