JQuery-mobile and obsolete data on pages

I'm just starting to experiment with jQuery and trying to apply it to a very simple CRUD application, which consists of a list, creating, editing and displaying pages.

I applied jQuery-mobile markup conventions and everything looks very pretty. However, I am confused by the issue of updating outdated data. I understand that jQuery-mobile redefines links and submits a form using AJAX to deliver a "one-page application." Again, this works for me, and all my data-role="page" stuff loads and fails correctly.

I don’t understand that when I change the data (for example, submit a form to create a new element, and then go to the list page), some pages must be updated from the server in order to receive the changed data. What jQuery-mobile does is simply re-render the previously loaded page, which is now out of date. Similarly, every time I re-visit the page creation page to create a new item, the form is still populated from the previous submission, since the page is not really refreshing.

If this is what I need for the script itself, this is fine, but I'm curious that it doesn't seem to be mentioned, what I would think of a common script in jQuery-mobile docs. Looks like I should be missing out on something obvious. How do other people deal with this?

+6
jquery-mobile
source share
2 answers

rel = external technology causes problems elsewhere, for example. you cannot deploy a fullscreen ipad application that uses rel = external.

I had exactly the same problem. I messed around with some fixes that were posted here

I inserted the following immediately after my link <script src="../../Scripts/jquery.mobile-1.0a4.1.min.js" type="text/javascript"></script> :

 script type="text/javascript"> $('div').live('pagehide', function(event, ui){ var page = jQuery(event.target); //alert('point 6875654'); if(page.attr('data-cache') == 'never'){ //alert('removing jqm history page'); page.remove(); }; }); </script> 

Then I added the data cache attribute as follows:

 <div class="page" data-role="page" data-cache="never"> 

This seemed to help a lot, although I still have some related issues related to ASP.NET security redirects.

+6
source share

My solution for a similar problem was to add rel = external to pages that are being updated dynamically. I wish there was a way to "re-cache" the page when adding dynamic content.

+2
source share

All Articles