jquery - Dynamic HTML plus window.onload won't work on ie -
greetings turkey,
i'm having difficulties window.onload , it's this:
i'm populating innerhtml of div using jquery.magiclick.js , fetching xml, has img definitions, ajax call. function calls magiclick function resided in document.ready this:
$().ready(function () { loginbanner(); }); and defined window.onload function in js. it's not needed i'll include code make myself clearer. calls window.onload function if there 1 defined , function passed parameter. here goes:
function addloadevent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.document.body.onload = function(){ alert("onload-1"); func(); }; } else { window.document.body.onload = function() { alert("onload-1"); if (oldonload) { oldonload(); } func(); }; } } i'm calling function @ bottom of page function parameter.
my expectation here fetch img definitions after document ready, , because definitions include img references, it'll fetch image data , execute onload function. works great on ff not on ie.
in ie, it's calling magiclick function fetches xml calling onload function @ time onload function executes, xml file have not been fetched.
i'm stuck , preciated.
thx reading post , first question please forgive me if i've made lingual or structural mistakes.
so, have idea may doing wrong? again.
ajax asynchronous , not have completed window load fire
call code within ajax success callback
using jquery ajax shorthand method $.get() example:
$.get( url, function(data){ /* ajax success, run code here */ })
Comments
Post a Comment