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!
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.
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.
精彩评论