View Single Post
Old 01-23-2012, 07:12 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
This would ONLY make sense if you ONLY want to submit the form by clicking on #request-link. In that case you can combine it to
Code:
$("#request-link").live("click", function () {
    $("#request").submit(function() {
        $.ajax({
            type: "POST",
            cache: false,
            url: "forms/add.php",
            data: $(this).serialize(),
            success: function (data) {
                $('#result').html(data);
            }
        });
        return false;
    }).submit();
});
This will bind the .submit() handler ONLY when you click on the #request-link!
devnull69 is offline   Reply With Quote