我正在使用HTML5,CSS3,JavaScript和jQueryMobile制作移动网络应用程序,并使用Phonegap
进行变形。
我是所有网络新手,我想知道,当我使用jQueryMobile进行UI时,我可以使用jQuery api进行Ajax调用,还是jQueryMobile拥有它自己的工具。
我需要使用Ajax,与外部Web服务进行交互,我将从数据库中获取(获取)和更新(获取/发布)。
换句话说,jQueryMobile是否支持所有jQuery api,还是我还要在我的应用程序中单独包含jQuery。
答案 0 :(得分:6)
$.ajax
/ <创建 AJAX
来电时,jQuery函数 jQuery
是标准功能强> jQuery Mobile
强>
使用 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!');
}
});
});
很少有事情需要考虑: