jquery - Problems with submitting a form -


im having following problem. form needs submitted , validated, form requested @ server , returns partialview when user clicks button. when put alert in function, alert once more everytime click submitbutton. basicly if have clicked 4 times, 5th time click 5 alerts.....

$(".btnupdatetopic").click(function () {         $("form").submit(function () {             alert("submit form");           });     }); 

i removed content of code see if there problem totaly stripped cannot work properly.

solution

eventualy got work code:

$(".btnupdatetopic").click(function () {         $("form").submit();         return false;     });         $("form").submit(function () {             alert("submit form");             return false;         }); 

take submit event out of click event , call submit in click event.

$(".btnupdatetopic").click(function () {     $("form").submit(); });  $("form").submit(function () {      alert("submit form"); }); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -