$("#loader").load(someurl, null, function ()
{
var html = $("#loader").html();
alert(html); //works
});
however,
$("#loader").load(someurl, "body", function ()
{
var html = $("#loader").html();
alert(html); //does NOT work
});
I try to fetch external host html data on phonegap/cordova.
filetransfer.download API does not work well for me for html fetching, and I found jQuery .load function works well and think it's uselful because file management isn't involved but only memory.
A problem is, since whole HTML is once load on some $("#loader"), css/style-sheet for html.body layer conflicts and messes.
Therefore, I try to fetch only body part of html http://api.jquery.com/load/
.load( url [, data] [, complete(responseText, textStatus, XMLHttpRequest)] )
however, [, data] option never works.
"html>body" does not work, or any selectors doen't seem to work.
Is this bug??
The selector should be appended to the url (separated by a space).
$("#loader").load(someurl + ' body', function (){
var html = $("#loader").html();
alert(html);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With