[英]Cannot dynamically load JavaScript file twice in IE
I have build this page. 我已经建立了这个页面。 when you click on a row in the table, the page send an ajax request for data and then dynamically creates a script in the body called which loads the graph. 当您单击表中的某一行时,该页面会发送一个数据的ajax请求,然后在被称为加载图形的主体中动态创建一个脚本。 It works in all chrome and FF but not in IE8. 它适用于所有chrome和FF,但不适用于IE8。 meaning -when you click on on row it work's but the second row and on the script are not loading.. I don't even know how to debug it in IE8. 意思是 - 当你点击行时它工作但第二行和脚本没有加载..我甚至不知道如何在IE8中调试它。 can someone recommend a solution? 谁能推荐一个解决方案? :-) :-)
the script that loads the other scripts is 加载其他脚本的脚本是
$.post("shorts.server.php", $.param({
val: stocknumber,
id: id,
name: stockname,
group: stockgroup
}), function (response) {
//alert(response);
// We dynamically add javascript headers
var head = document.getElementsByTagName('body')[0];
script = document.createElement('script');
//dynamic_graph.js changes it's content by the current selected stock
//see shorts.server.php for details
script.src = 'jQuery/head/dynamic_graph.js';
head.appendChild(script);
script = document.createElement('script');
//dynamic_graph.js changes it's content by the current selected stock
//see shorts.server.php for details
script.src = 'jQuery/head/dynamic_info.js';
head.appendChild(script);
});
Try to use jQuery.getScript : 尝试使用jQuery.getScript :
function(response)
{
$.getScript('jQuery/head/dynamic_graph.js');
$.getScript('jQuery/head/dynamic_info.js');
}
In IE9 press F12 to run the debugger. 在IE9中按F12运行调试器。 In the debugger you can select the browser mode like : IE8. 在调试器中,您可以选择浏览器模式,如:IE8。 Use Jquery for all your DOM interactions and browser compatibility. 使用Jquery进行所有DOM交互和浏览器兼容性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.