@@ -130,22 +130,24 @@ protected function constructJqueryAjaxCall($url)
130130 protected function constructNativeJsAjaxCall ($ url )
131131 {
132132 return
133- 'var xhr = new XMLHttpRequest(); ' .
134- 'xhr.open("GET", " ' .$ url .'", true); ' .
135- 'xhr.onreadystatechange = function() { ' .
136- 'if(xhr.readyState == 4 && xhr.status == 200) { ' .
137- 'var container = document.getElementById(" ' .$ this ->getContainerId ().'"); ' .
138- 'container.innerHTML = xhr.responseText; ' .
139- 'var scripts = container.getElementsByTagName("script"); ' .
140- 'for(var i=0; i < scripts.length; i++) { ' .
141- 'if (window.execScript) { ' .
142- 'window.execScript(scripts[i].text); ' .
143- '} else { ' .
144- 'window["eval"].call(window, scripts[i].text); ' .
133+ 'setTimeout(function() { ' .
134+ 'var xhr = new XMLHttpRequest(); ' .
135+ 'xhr.open("GET", " ' .$ url .'", true); ' .
136+ 'xhr.onreadystatechange = function() { ' .
137+ 'if(xhr.readyState == 4 && xhr.status == 200) { ' .
138+ 'var container = document.getElementById(" ' .$ this ->getContainerId ().'"); ' .
139+ 'container.innerHTML = xhr.responseText; ' .
140+ 'var scripts = container.getElementsByTagName("script"); ' .
141+ 'for(var i=0; i < scripts.length; i++) { ' .
142+ 'if (window.execScript) { ' .
143+ 'window.execScript(scripts[i].text); ' .
144+ '} else { ' .
145+ 'window["eval"].call(window, scripts[i].text); ' .
146+ '} ' .
145147 '} ' .
146148 '} ' .
147- '} ' .
148- ' } ; ' .
149- 'xhr.send( ); ' ;
149+ '}; ' .
150+ ' xhr.send() ; ' .
151+ '}, 0 ); ' ;
150152 }
151153}
0 commit comments