You dont need to submit again inside the submitHandler function. $("form#send_gb").validate({ submitHandler: function(form) { var gb_post = $("#gb_post").attr("value"); var userid = $("#userid").attr("value"); var ownerid = $("#ownerid").attr("value"); $.ajax({ type: "POST", url: "_scripts/send_message.php", data: "action=send_gb& gb_post="+ gb_post +"& userid="+ userid +"&ownerid="+ ownerid, beforeSend: function() { $("#gbPosts").prepend("<div id='sending'><div>"); }, success: function() {
$("#gbPosts").load("_members/gb_posts.php?funk&userID="+userid, function(){ $(".gb_message:first-child").hide().fadeIn(1200); $("#gb_post").attr("value",""); }); } }); } }); On Sun, Nov 15, 2009 at 17:51, Jojje <jojjsus_chr...@hotmail.com> wrote: > Hi, i cant figure this one out!!! > > I´m using the validation plugin and want to validate a form to a > guestbook. Im using ajax to post the message . > the problem is that when i submit the form the first time it´s fine, > but the second time it posts twice, and the third time it posts three > times, and so on. adding one every time i submit. heres the script: > > $(function() { > $("form#send_gb").validate({ > submitHandler: function(form) { > $(form).submit(function(e) { > var gb_post = $("#gb_post").attr("value"); > var userid = $("#userid").attr("value"); > var ownerid = $("#ownerid").attr("value"); > $.ajax({ > type: "POST", > url: "_scripts/send_message.php", > data: "action=send_gb& gb_post="+ gb_post +"& > userid="+ userid +"& > ownerid="+ ownerid, > beforeSend: function() { > $("#gbPosts").prepend("<div > id='sending'><div>"); > }, > success: function() { > > $("#gbPosts").load("_members/gb_posts.php?funk&userID="+userid, > function(){ > > $(".gb_message:first-child").hide().fadeIn(1200); > $("#gb_post").attr("value",""); > }); > } > }); > e.preventDefault(); > }); > } > }); > }); > > Does anyone see what i´m doing wrong? help would be muuuuch > apreciated. > > Thanks in advance > > Jojje >