Dynamically loaded js function does not appear in Firebug js debugger

There is a page1.html file (I open it in a browser):

<div id="content"> </div> <script type="text/JavaScript"> jQuery.ajax({ type : "GET", url : 'page2.html', dataType : "html", success : function(response) { jQuery('#content').append(response); } }); </script> 

Page Code2.html:

 <script type="text/JavaScript" src="js/page2.js"></script> <script type="text/JavaScript"> test(); </script> 

Page Code js / page2.js:

 function test() { alert('Function Test()'); } 

Everything works well, the "Function Test ()" window is displayed. But the problem is that I cannot get the test () function code in the firebug js debugger. It does not appear in event scripts or in eval.

How can i fix this?

FYI: If I do not put the function in a separate js file, but put it in page2.html, this appears in the debugger in different ways.

If I put the word "debugger" in the test () function, Firebug stops, but the function source code is still not available.

Versions: Firefox 3.0.10, Firebug 1.3.3

Update: almost the same as the question Creating Firebug in dynamically loaded javascript , but no answer yet

+4
javascript jquery debugging firebug
May 17 '09 at 9:43 a.m.
source share
3 answers

This is a hack, but I got firebug to stop in the external js/page2.js file by adding the word debugger twice. Once at the top of the file and at another time at the top of the function.

If the debugger word exists only once anywhere, firebug does not stop.

 debugger; function test() { debugger; alert('Function Test()'); } 
+4
May 17 '09 at 11:24
source share

What happens when you change js / page2.js to:

 function test() { alert('Function Test()'); } alert('loaded'); 

Do you see the message "downloaded"?

0
May 17 '09 at 11:01
source share

Try:

 eval('debugger;'); 

This is not very, but it seems to work.

0
Mar 06 '11 at 12:29
source share



All Articles