Advertisement

11.25.2008 at 01:36AM PST, ID: 23933402 | Points: 250
[x]
Attachment Details

Javascript and Ajax - firing when a div is updated with new content

Asked by MatthewP in Asynchronous Javascript and XML (AJAX), JavaScript, JavaScript Frameworks

Tags:

In case the title doesnt make this obvious, Im doing an ajax call, updating a div with the result and then I need to run some javascript on the div - essentially scanning for textareas and turning them into instances of tinyMCE. My question is what to trigger this from.

Im using mootools 1.11 for the ajax call and div update, and it has functions such as onComplete/onSuccess but these trigger when the call is completed/successful, not when the div is updated with the new content. I've tried writing my own too but seem to run into the same problem - even if i've coded to update the div and then run the javascript it runs before the div has finished updating.

Obviously onLoad is out of the question as its not a new page, and embedding javascript into the page doesnt run either - obviously the page is scanned for javascript as the page loads into the browser window/tab but not when a div is updated, so it just sits there.

Has anyone got any good ideas for a way round this either with the mootools framework or another method?

Thanks,
MattStart Free Trial
 
Loading Advertisement...
 
[+][-]11.25.2008 at 11:51PM PST, ID: 23040163

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081119-EE-VQP-49 - Hierarchy / EE_QW_2_20070628