views:

27

answers:

2

I want to inspect the request that will change window.location or whatever it may be using to change the url. I don't know where in the code it is changing the url so I can't put a breakpoint in there.

How can I use Firebug to allow Ajax requests but prevent the url from changing? Or how can I otherwise inspect the request that will change the url?

Thanks!

+1  A: 

You can wrap the ajax request in a function and return false. Then you can click it and it wont take you away. For example, I have a function that looks like this

$('.flag-commentflag a').click(function() {
    var url = $(this).attr('href');
    $.get (url, function (data) {
    console.log(data);
    });
 return false;
});

Where .flag-commentflag is the class of the div surrounding the link.

Toxid
it's on a form, this is a good idea though, thanks!
viatropos
+2  A: 

You can click the "persist" button on the net tab. (and other tabs) Was a real "oh duh" moment for me when I noticed it.

jeremiahd