Here is my situation:
i have a page once clicking on one of it's divs an ajax request fetches more content to the page.
The more content that i am talking about is image gallery content that uses jQuery.
my problem is that once i get the response from the ajax request, i manipulate the DOM.
therefore the jquery ready() function is not available to me anymore (or is it ?)
to skip the problem i assigned a function to the
$.fn
called InitGallery
.
Using eval
i can call it once my ajax response arrives and all is fine except one small issue- synchronization!
Once i eval
my $.fn.InitGallery
code, the manipulated DOM is not necessarily fully loaded, and therefore my InitGallery fails.
Once i add a sleep, or alert to my code, and make sure that the InitGallery function runs after the DOM is ready again, it's fine and working.
i guess my question is how can i re assign a ready function to the DOM ? how can i make sure that the function i call after the ajax response gets called only after the changes the ajax response did on the DOM are ready ? thank you