Question pertaining to .load() and loading javascript

When i load a page using the .load() funtion that page dosnt display javascript.

example: googleads will not display via the new page that was loaded thru .load()

function updateElement(el_id, action) {
	if (document.getElementById(el_id).innerHTML == ""){
     $('<div id="info" />').load('''+action+' #ghgh', function() 

Hi,

i have one solution for you.
You can return result as JSON
example

 { javascript: 'script content', html: 'html' }

and when you receive response you can execute script, but first of all you need to append you html than call script, reason for this is because script might need something from returned HTML

You can execute your script like this


var s = 'alert("senad");';
s += 'alert("meskin");';
s += 'var a = 10; var b = 13;';
s += 'var c = a+b;';
s +='alert(c);'
eval(s);

Full example:

$.post('/info/getinfo/',
        {
            mode: 'sample of sending var trough post',
        }, function(data){            
           $('#targetdiv').html(data.html);
           eval(data.javascript);
        }, 'json');

or you can create custom javascript that will be executed when loading is done.