views:

22

answers:

2

I'm hijacking the click event and doing a $.get() on the href. Problem is, that the function that I'm defining doesn't get executed.

Firebug Console, shows that a GET request was actually made:

    GET http://localhost:8000/products/a-26-tavella-grip-168168-1a-3/ 200 OK 12ms

So, not sure what to make of this, the page is just a simple HTML page.

$(document).ready(
    function (){
    $("a.product_link").click(function(event) {
        event.preventDefault();
        address = $(this).attr("href");
        $.get(address, function() {alert('get was performed.');});
    });
});

Any ideas why the function doesn't get called?

p.s. prior to this, the signature of the function included data, which I wanted to use, but console.log(data) returned as undefined.

A: 

Try passing your 2nd parameter as null

Shiv
explicitly setting data to null changes nothing mate :(
panosl
A: 

It seems Firebug is the culprit here. Disabling it allows the code to execute.

Not sure why though, it's stealing focus of the Ajax call when it GETs back.

panosl