event.preventDefault(); 停止在FF工作

I have the following code, which did work fine until just now, event.preventDefault(); doesn't seem to trigger in FireFox? In Chrome the code still works fine, in Firefox however, it takes me to blank page and I see generated code there instead.

    $("#generate_code").click(function(){
        event.preventDefault();
        $('#code').html('Generating Code..');
        hideshow('loading',1);
        setTimeout(function() {
            $.get("generate-code.php", function(data) {
                $("#code").html(data);
            });
            hideshow('loading',0);
        }, 2000);
   });

generate-code.php:

function generateRandomString($length = 50) {
    $characters = '!@#$%^&*()0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, strlen($characters) - 1)];
    }
    return $randomString;
}

$invitecode = generateRandomString();
echo $invitecode;

You should be calling preventDefault on the event object passed as argument to the handler to make sure that everything works cross-browser.

$("#generate_code").click(function(e){
    e.preventDefault();
    ...