jquery read in HTML file and return the file as an object-why doesn't it work? -


i'm wondering if maybe code doesn't work because can't return jquery object function. code doesn't work:

var html_file_url = '/solutions1.htm'; var strall = $.get(html_file_url, function (data) {                       var filedom = $(data);                       return filedom;                 });  $("#qapagediv").append(strall.html()); 

however, code work:

 var strall = $.get(html_file_url, function (data) {          var filedom = $(data);          $("#qapagediv").append(filedom);          return filedom;   }); 

your problem $.get returns $.deferred().promise(), not return value callback.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -