When I use jquery’s .load() function to load the next pages body it does not retrieve the class of the body of that page. Is there a way to achieve this?
Thank you 🙂
Here is the code:
$(document).ready(function () {
if(navigator.standalone){
$('a').live("click", function (e) {
var link = $(this).attr('href');
if ($(this).hasClass('noeffect')){
}
else {
e.preventDefault();
$("body").load(link);
};
});
}
else {
window.scrollTo(0, 0.9);
}
});
so your putting a body inside a body? not sure that’ll work as expected!
some html would be helpful, but i’m guessing that is what the problem is.
in the pages that you are loading into your body, put them inside a div instead of a body tag. that should avoid the body inside a body problem.
Edit:
what you could do is do a regular ajax call to get your new html. then remove your current body, and append the stuff you get back from the ajax call to your html. I’ve never tried something like that, but if you can’t change the html that your getting back, it’s probably the best thing to try.