Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created March 22, 2011 17:39
Show Gist options
  • Save ahoward/881652 to your computer and use it in GitHub Desktop.
Save ahoward/881652 to your computer and use it in GitHub Desktop.
jq('div').live('pagebeforeshow', function(event, ui){
var page = jq(event.target);
var url = page.attr('data-refresh');
if(url){
var ajax = {};
ajax.url = url;
ajax.type = 'GET';
ajax.cache = false;
ajax.data = {'refresh' : true };
ajax.async = false;
ajax.success = function(data){
var hidden = jq(data).hide().appendTo(jq.mobile.pageContainer);
html = hidden.html();
page.html(html);
// TODO - how to properly initialize the page?
//
page.page();
var all = jq("<div></div>");
all.get(0).innerHTML = html; // force <script> tags to fire...
};
jq.ajax(ajax);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment