I have defined a click function in the document ready

$(“#submit_request_toggle”).click(function() {
$(‘#submit_request’).slideToggle(500);
});

Later, I do an ajax call and I want to be able to redefine the click so that the link doesn’t work anymore (after my ajax call)

$.ajax({
type: “POST”,
url: “index.php”,
data: “action=submit_request&first_name=” + $(‘#submit_request_form input[name=first_name]’).val() + “&last_name=” + $(‘#submit_request_form input[name=last_name]’).val() + “&message=” + $(‘#submit_request_form textarea[name=message]’).val(),
success: function(msg){

$(“#submit_request_toggle”).click(function() { return false; });
$(“#submit_request”).fadeOut(500, function() { $(“#submit_request_response”).html(msg).fadeIn(); } );
}

For some reason, this line:

$(“#submit_request_toggle”).click(function() { return false; });

doesn’t work– the link still shows the hidden div even after I redefine it. Weird.

By Jason

Leave a Reply

Your email address will not be published. Required fields are marked *