admin管理员组文章数量:1394390
I'am loading html with some inline javascript on a $.post callback. Something "like that" :-)
callback{
response_data = '<p>string with html and </p><script "javascript">var scripts...</script>'
jQuery('#selector').html(response_data);
}
But when I do that, I can't see the new inline javascript loaded on Chrome's Scripts Tab. I see that JS on Network tab and js is executing but I can't debug this code.
Any idea about how to debug this code? Thanks!
I'am loading html with some inline javascript on a $.post callback. Something "like that" :-)
callback{
response_data = '<p>string with html and </p><script "javascript">var scripts...</script>'
jQuery('#selector').html(response_data);
}
But when I do that, I can't see the new inline javascript loaded on Chrome's Scripts Tab. I see that JS on Network tab and js is executing but I can't debug this code.
Any idea about how to debug this code? Thanks!
Share Improve this question asked Dec 13, 2011 at 12:48 rubdottorubdotto 8,31811 gold badges41 silver badges60 bronze badges 2-
have a look at
Console tab
, right click and select check XMLHTTPRequest – cristian Commented Dec 13, 2011 at 12:50 - Because i suppose browsers do not listen to asynchronous calls to update the list of avaiable files – Pawan Commented Dec 13, 2011 at 12:51
1 Answer
Reset to default 8All modern JS engines do allow to generate a javascript break-point "in-code".
To do that, you need to execute the debugger;
statement somewhere in your code. As soon as the js engine reads that mand, a break point is set and the debugger is loaded.
You might want to give that a shot. It might still not work correctly since dynamic script insertion can still be trouble and pain, depending how and when you do it.
It would definately a better idea to do it more "accurate" by creating and inserting a new script element
var myscript = document.createElement('script');
myscript.textContent = 'var scripts = 42; alert("hello");';
myscript.type = 'text/javascript';
document.body.appendChild(myscript);
本文标签: Why can39t I seedebug javascript loaded with jqueryhtml() with ChromeStack Overflow
版权声明:本文标题:Why can't I seedebug javascript loaded with jquery.html() with Chrome - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744644658a2617327.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论