This is kind of related to previous post "Dynamic script file
loading", but I cant solve the following problem. Please help. It's
basically an IE problem.
I'm writing an AJAX application where each page of the site is loaded
dynamically by the client side application. So for example the user
clicks home, and the client side app makes an AJAX call to the server
for the content and replaces the contents of a container div with this
new content. Each page has some Javascript that needs to be
dynamically added to the page as well, so here I'm adding a script
element into the container as well. Once all that's done I call a
predefined onload function in the returned script so that the page
content can take over and do it's thing (setting up page related
stuff)
The difference with the previous post is that my javascript is
returned in the AJAX call, I have no files to dynamically reference on
the server, the Javascript comes in the AJAX response.
BUT the following code hands in IE7 when it gets to the .update and I
don't know why.. this otherwise works in other browsers.
// add html to container.
container.update(new_content_html);
// add javascript to container.
var el_script = new Element('script', { 'language':
'JavaScript', 'type':'text/JavaScript' });
el_script.update(new_content_js); // ?????? IE7 hangs
here ?????
container.insert( el_script );
// call the template load event.
var function_name = 'template_'+ template_name
+'_onload';
eval(function_name + '();' );
As an aside I did, previous to this solution, try to combine the page
HTML and inline Javascript and do a single update.
container.update(new_content);
however my _onload functions would not be registered in the browser
causing the "call the template load event" part above to fail, dispite
Prototype docs saying that Update evals inline scripts, well it does
but the functions would not register.
So either a solution to the first or an explination of the second
method would be most appretiated.
Thanks heaps every one.
DaveC
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---