我必須使用PhoneGap的1.5.0和jQuery移動1.1.0 .... 做我有這樣Web服務不叫第二次,如果我提出請求到web服務器
<div data-role="page" id="page1">
</div>
<div data-role="page" id="page2">
</div>
結構的應用
我呼籲第2頁的頁面顯示一個Web服務這樣的
$("#page2").on("pageshow", function(e) {
$
.ajax({
type : 'GET',
url : "http://192.168.1.88:9051/some.xml"
+ "?time=" + Date.now(),
data : {
key : "value"
},
dataType : "xml",
success : function(xml) {
},
error : function(xhr) {
alert("Error while loading the Mock Service !!!");
}
});
});
,如果我是第一次到第二頁輸入這工作得很好。假設如果我導航回到page1,然後再回到Page2,那麼Web服務不會被調用。
我甚至用pageinit嘗試過,它沒有工作......這是一些Ajax問題?
如何糾正?
http://stackoverflow.com/questions/5622581/jquery-mobile-document-ready-equivalent要求使用pagebeforeshow。 – ganeshran 2012-04-02 06:44:12