Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
175
rated 0 times [  178] [ 3]  / answers: 1 / hits: 15367  / 11 Years ago, wed, july 17, 2013, 12:00:00

I have a Cocoa WebView that displays a local HTML file. I'm trying use jQuery.load() to load another local HTML file into a div. My JavaScript code goes something like this:



$(#mydiv).load(test.html);  // test.html is a local file inside the app's bundle


I don't see any exceptions but it will not load the html inside the div. I'm using exactly the same code for an iOS app, and it works fine. I've also tried using XMLHttpRequest() and I can see the responseText fine.



Any advice? Thanks in advance!


More From » jquery

 Answers
118

I was able to get around the problem by using jQuery.ajax instead. Here's how I did it:



jQuery.ajax({ 
url: test.html, dataType: html
}).done(function( responseHtml ) {
$(#mydiv).html(responseHtml);
});


Hope it helps someone!


[#76918] Wednesday, July 17, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jase

Total Points: 442
Total Questions: 107
Total Answers: 94

Location: Sao Tome and Principe
Member since Wed, Dec 29, 2021
2 Years ago
;