调试JavaScript的code,它来作为Ajax响应的一部分它来、JavaScript、code、Ajax

由网友(莫忘初心)分享简介:所以,在我的网站,我使用jQuery通过Ajax来获取数据。作为Ajax响应的一部分,一些JavaScript的code提供其执行也是如此。现在的问题是如何调试这个JavaScript的萤火虫或其他工具。这是我迄今为止的经验:So in my website, I use jquery to fetch data t...

所以,在我的网站,我使用jQuery通过Ajax来获取数据。作为Ajax响应的一部分,一些JavaScript的code提供其执行也是如此。现在的问题是如何调试这个JavaScript的萤火虫或其他工具。这是我迄今为止的经验:

So in my website, I use jquery to fetch data through ajax. AS part of the ajax response, some of the javascript code comes as well which is executed. The problem is how to debug this javascript in firebug or other tools. This is my experience so far:

将调试;不能正常工作 对于一些javascript,不能设置断点为尚未加载脚本。 即使这个新的JavaScript调用已加载一些其他的功能,这就是(即我可以看到它在Firebug,设置断点),在该函数断点仍然没有触发

不过,JavaScript并执行时正常,甚至像的console.log的作品,但不能似乎调试它..

However, the javascript does executes normally and even things like console.log works but cant seem to debug it..

推荐答案

如果你使用谷歌浏览器,检查出这个问题的答案: http://stackoverflow.com/a/10929430/482916

If you use Google Chrome, check out the answer of this question: http://stackoverflow.com/a/10929430/482916

您需要在AJAX加载JS脚本添加了如下评论:

You need to add in the ajax-loaded JS scripts the following comment:

//@ sourceURL=dynamicScript.js

其中的 dynamicScript.js 的是它会在控制台中的脚本的名称。

where dynamicScript.js is the name of the script which will come up in the console.

阅读全文

相关推荐

最新文章