javascript - js loaded by jquery.get() cannot be debugged with breakpoints
滿天的星座
滿天的星座 2017-05-19 10:20:57
0
2
423

JS loaded by jquery.get() cannot be debugged with breakpoints. Is there any good solution?

滿天的星座
滿天的星座

reply all(2)
漂亮男人

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
});
曾经蜡笔没有小新

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,

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template