javascript - Submit button in a header fails to submit -


i'm developing jquery mobile app. in app there form user has submit , i've placed submit button in right side in header. when user done filling of form , taps on submit button class of "ui-btn-right", fails submit.

$(document).ready(function(){     $('.ui-btn-right').on('click', function(event) {       $("#form1").on('submit',function(event){         event.preventdefault();         data = $(this).serialize();          $.ajax({           type: "post",           url: "register.php",           data: data         }).success(function() {           $("input[type=text]").val("");         });       });     }); }); 

html

<a href='#' class='ui-btn-right' id="button" >register</a> 

just taking guess here, can't see markup. looks you're not submitting form when click button, you're wiring submit event. try this?

$(document).ready(function(){      $('.ui-btn-right').on('click', function(event) {        $('#form1').submit();      });        $("#form1").on('submit',function(event){      event.preventdefault();      data = $(this).serialize();        $.ajax({        type: "post",        url: "register.php",        data: data      }).success(function() {        $("input[type=text]").val("");      });    });  });


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -