How do I debug Javascript which was loaded via AJAX (specifically jQuery)

前端 未结 4 2039
既然无缘
既然无缘 2020-12-12 21:42

I have changed my coding style with more complex projects to loading pages (And their embedded scripts) \"on demand\" recently. However, it is difficult to debug those scrip

4条回答
  •  [愿得一人]
    2020-12-12 22:32

    As you have already mentioned, you can use //@ sourceURL. Chrome doesn't seem to be supporting //@ sourceURL for inline scripts. It does work on eval expressions. This HTML5 article on source maps gives more details about naming eval blocks and naming of any anonymous functions in your code.

    Instead of using eval, you can try embedding a script tag or JSONP may be.

提交回复
热议问题