Open full view…

Cache Dynamic Pages Created through XHR response from Server

Fri, 22 Sep 2017 09:21:01 GMT

I'm developing app which includes multiple pages. In my app some pages are created from responses of XHR ajax requests to database. For example in page titled as *products*, there is a list of products which is created each time I visit it through following code: ---html myApp.onPageInit('page_products', function(page) {(...)}; --- After multiple navigation when I come back to *products* page, is there any way to load this page without re-sending XHR ajax request to the database? Can I store created dynamic pages entirely somewhere and load it instead of creating again? I also used ---html var myApp = new Framework7({ cache:true }) --- but this setting just stores primitive html page without appended contents retrieved from database.

Sat, 23 Sep 2017 12:27:06 GMT

I solved it :) :) :D

Wed, 11 Oct 2017 17:49:19 GMT

How did you solve it?

Tue, 31 Oct 2017 12:02:50 GMT

jquery.html() function can be used to save the whole page as a string variable. then you can append this variable to your element (ie: page content) after returning to page