extjs - Why doesn't javascript execute in .php file loaded with Ext.Ajax.Request? -


i want load .php files via ajax execute extjs script load, in turn modifies existing extjs objects present in dom.

however, can't javascript execute page being loaded via ext.ajax.request. , no errors showing in firebug net panel. php code gets executed, not javascript. when call page being loaded in browser, executes javascript fine.

how can javascript execute in pages loaded ext.ajax.request?

ext.onready(function(){      var menuitemstart = new ext.panel({         id: 'panelstart',         title: 'start',         html: 'this start menu item.',         cls:'menuitem'     });      var menuitemapplication = new ext.panel({         id: 'panelapplication',         title: 'application',         html: 'this application page',         cls:'menuitem'     });      var regionmenu = new ext.panel({         region:'west',         split:true,         width: 210,         layout:'accordion',         layoutconfig:{             animate:true         },         items: [ menuitemstart, menuitemapplication ]     });      var regioncontent = new ext.panel({         id: 'contentarea',         region: 'center',         padding:'10',         autoscroll: true,         html: 'this content'     });      new ext.viewport({         layout: 'border',         items: [ regionmenu, regioncontent ]     });      menuitemstart.header.on('click', function() {        ext.ajax.request({            url: 'content/view_start.php',            success: function(objserverresponse) {                regioncontent.update(objserverresponse.responsetext);            }        });     });      menuitemapplication.header.on('click', function() {        ext.ajax.request({            url: 'content/view_application.php',            success: function(objserverresponse) {                 regioncontent.update(objserverresponse.responsetext);            }        });     }); }); 

the file being loaded via ajax:

<script type="text/javascript">     window.onload=function() {         alert('from application view'); //is not executed     }      //ext.onready(function(){     //    alert('from application view extjs'); //is not executed     //} </script> <?php echo 'this application view @ ' . date('y-m-d h:i:s'); ?> 

when ajax response onload event on window has been fired function won't executed because onload event won't fired again. try alert:

<script type="text/javascript">     alert('from application view'); </script> <?php echo 'this application view @ ' . date('y-m-d h:i:s'); ?> 

update

browsers don't execute injected scripts in way can try like:

var scripts, scriptsfinder=/<script[^>]*>([\s\s]+)<\/script>/gi; while(scripts=scriptsfinder.exec(responsetext)) {    eval(scripts[1]); } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -