Response title
This is preview!




Can you point me to any documentation on .page() ?
Below you will see how I used the destroy in a real example in a Java Script using Ajax to refresh. I needed to do this for the reason Jquery mobile CSS gets lost after a Ajax request to update content.
function makePOSTRequest(section, parameters) {
http_request = new XMLHttpRequest();
http_request.open("post", "/Requests.aspx", true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.send(parameters);
http_request.onreadystatechange = alertContents;
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
result = http_request.responseText;
try {
top.parent.document.getElementById(section).innerHTML = result;
//Style the Ajax request
$("div[data-role=page]").page("destroy").page();
}
catch (e) {
alert("The HTTP Request could not find section: " + section + "! RE: Function - MakePostRequest")
};
try {
var node = top.parent.document.getElementById(section);
}
catch (e)
{ };
var st = node.getElementsByTagName("SCRIPT");
for (var i = 0; i < st.length; i++) {
var strExec = st[i].text;
st[i].text = "";
var x = document.createElement("SCRIPT");
x.type = "text/javascript";
x.text = strExec;
try {
top.parent.document.getElementsByTagName("head")[0].appendChild(x);
}
catch (e) {
alert("Unable to append head!")
};
}
}
else {
alert(section);
alert(parameters);
alert("AJAX HTTP REQUEST ERROR IN DATA: " + http_request.status);
}
}
}
};© 2012 jQuery Foundation
Sponsored by
and others.
