2014-07-23 40 views
0

我們如何傳遞$ .mobile.changePage上的對象並在「pagebeforeshow」上訪問它?

我使用JQM 1.3.1和jQuery 1.9.1

$.mobile.changePage("Next.html", {data: RespObj}); 

$(document).on("pagebeforeshow","#next", function(data) 

{ 
    alert(JSON.stringify(data)); 
}); 

任何人都可以請幫我想出解決辦法。我無法在showbefore之前訪問此數據。

+0

您正在使用什麼版本的JQM ??,(pagebeforeshow)可能會因您正在使用的版本而被解除。你也需要一個選擇器,我認爲(documnet)在哪裏。 --- http://api.jquerymobile.com/pagebeforeshow/ – Tasos

回答

0

正如我所看到的,我認爲你做了一些語法錯誤的pagebeforeshow部分。

你的代碼更改爲以下之一,檢查,希望它會工作:

試試這一個

$.mobile.changePage("Next.html#next", {data: RespObj}); 

    $(document).on("pagebeforeshow",function(data) 

      { 
       alert(JSON.stringify(data)); 
      }); 

,如果它工作,不要忘記投票

謝謝和所有最好的

相關問題