Skip to content

Instantly share code, notes, and snippets.

@tatsuyaueda
Created May 17, 2013 00:37
Show Gist options
  • Save tatsuyaueda/5596200 to your computer and use it in GitHub Desktop.
Save tatsuyaueda/5596200 to your computer and use it in GitHub Desktop.
jQueryMobile Dynamic Content Rewrite(2)
$(".force-reload").click(function() {
$.get(document.URL, function(data) {
// 読み込みし直すページコンテナを指定
var anchor = "#" + document.URL.split("#")[1];
var $content = $(anchor).children(":jqmData(role=content)")
var $newContent = $("<div>" + data + "</div>").children(anchor).children(":jqmDatazrole=content)").children();
$content.html($newContent).trigger("create");
$content.find(":jqmData(role=listview)").listview();
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment