Advertisement

Running script when loaded by AJAX

Moderators: Calcifer, slothy

Running script when loaded by AJAX

Postby asundli » Wed Jun 28, 2006 10:21 pm

Hi.

I use this function to execute/load script added by a Ajax request.

This works perfectly, and I can even call the javascript function loaded by ajax/innerHTML.

The question is what happens to the browsers memory use? I load the <script> tag into the head several times. maby 1000 if you do this long enough.



function executeScript(div)
{

var x = div.getElementsByTagName("script");
for(var i=0;i<x.length;i++)
{
eval(x[i].text);
var scriptTag = document.createElement('script');
scriptTag.innerHTML = x[i].text;
scriptTag.type = 'text/javascript';
var head = document.getElementsByTagName('head').item(0);
head.appendChild(scriptTag);
}
}

Any ideas?

Best regards
Alexander
www.keyteq.no
asundli
 
Posts: 37
Joined: Tue Nov 01, 2005 12:45 pm
Location: Bergen

Return to Javascript

Who is online

Users browsing this forum: No registered users and 0 guests

cron