JS loaded by jquery.get() cannot be debugged with breakpoints. Is there any good solution?
漂亮男人2017-05-19 10:22:57
When requesting through ajax, one of the attributes cache is true by default, except when the type is script and jsonp. You can let the browser cache the js file you requested, and then perform breakpoint debugging.
You can try setting this up.
$.ajaxSetup({
cache:true
});
曾经蜡笔没有小新2017-05-19 10:22:57
The poster said it cannot be debugged because the code returned by get is eval
或者是new Function
去执行了,代码在内存中,所以找不到,其实如果代码里面有console.log
,你会看到控制台打印的代码的行数未VM:xxxx
, which means the code is in memory.
Solution: Save the code returned by get locally, and then write a page to run this code, and you can debug it,