Difference between revisions of "Jqm"
From Wiki2
(Created page with " pageinit doesn't fire if its in the loaded .js <pre> <body> <div id="indexPage" data-role="page"> <script type="text/javascript"> $("#indexPage").live('p...") |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
====pageinit doesn't fire if its in the loaded .js so put it in the div==== | |||
pageinit doesn't fire if its in the loaded .js | |||
<pre> | <pre> | ||
<body> | <body> | ||
Line 12: | Line 11: | ||
</body> | </body> | ||
</pre> | </pre> | ||
====Why do I have to reload the page when I arrive from another jquery page? ANS: data-ajax="false" ==== | |||
The setup: | |||
Consider this URL http://10.0.1.18/webeshoppin/stuff2get/www/food2buy.html?repo=Sobaza&list=groceries | |||
I use the pageinit function jquery mobile function to get the url variables and fill the page with lists from a getJSON call. It works fine | |||
But when I put that link in another jquerymobile page as a link with a query string | |||
<pre> | |||
<li><a href="food2buy.html?repo=Sobaza&list=groceries">Grocery List</a></li> | |||
</pre> | |||
After the click the URL changes but the page doesn't really reload. | |||
Paginit is firing but even though the right URL is in the browser address bar when I look inside pageinit.. | |||
<pre> | |||
$('#thelist').bind('pageinit', function(event) { | |||
console.log("is this firing ?"); | |||
console.log(window.location.href); | |||
</pre> | |||
I see (window.location.href) shows the prior page when it arrives from the link but the current page when I just put the URL in the browser. How do I get it to update from the link? | |||
=====because you need to add data-ajax="false" to each <a href="hhtt:ybut.net data-ajax="false">===== |
Latest revision as of 16:51, 24 January 2012
pageinit doesn't fire if its in the loaded .js so put it in the div
<body> <div id="indexPage" data-role="page"> <script type="text/javascript"> $("#indexPage").live('pageinit', function() { // do something here... }); </script> </div> </body>
Why do I have to reload the page when I arrive from another jquery page? ANS: data-ajax="false"
The setup: Consider this URL http://10.0.1.18/webeshoppin/stuff2get/www/food2buy.html?repo=Sobaza&list=groceries
I use the pageinit function jquery mobile function to get the url variables and fill the page with lists from a getJSON call. It works fine
But when I put that link in another jquerymobile page as a link with a query string
<li><a href="food2buy.html?repo=Sobaza&list=groceries">Grocery List</a></li>
After the click the URL changes but the page doesn't really reload.
Paginit is firing but even though the right URL is in the browser address bar when I look inside pageinit..
$('#thelist').bind('pageinit', function(event) { console.log("is this firing ?"); console.log(window.location.href);
I see (window.location.href) shows the prior page when it arrives from the link but the current page when I just put the URL in the browser. How do I get it to update from the link?