How to use execScript with loading content via ajax

Hi,



I am using dhtmlxLayout and I am loading content via ajax as follows



dhxLayout.cells(“a”).window.attachURL(‘msOpenX.asp’,true);



Page: msOpenX.asp contains some script in tags which I want executed when page is loaded via ajax.



I am not sure how to use execScript with this. Any help would be appreciated.



Thanks,

Kris




Hello,


layout doesn’t executes the script that is defined in the page loaded by ajax.


It is better to call script from the main page:


layout.parentDhxWins.attachEvent(“onContentLoaded”,function(win){


if(win==dhxLayout.cells(“a”).window) callScript();


});

It does not seem to work

This is simple code inside loadLayout.asp

    

msOpenX.asp contains the following script tags with some html content as an example

html content and script tags are loaded but script is not executed.



loadAlert() function should be define in the page with layout - all content of “msOpenX.asp” is added as innerHTML.


But there is also and issue in the approach that we have provided before. There should be dhxWins instead of parentDhxWins. and this function should be included before attachURL method to be called.



function loadAlert(){
window.alert(‘Content loaded and script executed’);
}



dhxLayout.dhxWins.attachEvent(“onContentLoaded”,function(win){
if(win==dhxLayout.cells(“a”).window) loadAlert();
});


dhxLayout.cells(“a”).window.attachURL(‘msOpenX.asp’,true);