javascript - jQuery stopPropagation not working on table/mobile -


i have submit form login looks this:

handleloginsubmit: function() {     $('#login-form, .login-form').submit(function (e) {         e.stoppropagation();         var $form = $(this);         $.ajax({             url: 'loginurl',             type: 'post',             data: $(this).serialize(),             success: function (r) {                 if (r.redirect) {                     window.location = r.redirect;                 } else {                     //wrong username or password                 }             }         });     }); }, 

this works fine on computer, , other computers matter. seems work on android phone. i've tried both on ipad , iphone , neither works.

the problem when submit form json data printed out on screen this:

{"login":true,"redirect":"https://frontpageurl"} 

but supposed redirect front page url.

so when logging in, on iphone or ipad, redirect front page not work.

i first tried e.preventdefault() seems work fine in other similar parts of project. tried e.stoppropagation() , e.stopimmediatepropagation(). none of these seem change anything.

i doubt it is
working on computer , android phone.

as using e.stoppropagation(); in submit event has $.ajax() call , have has nothing anything. when submit form submitted.

if using ajax first thing follow stop form submission using. can event.preventdefault();. so, better use it:

handleloginsubmit: function() {     $('#login-form, .login-form').submit(function (e) {         e.preventdefault();         // other code }, 

about e.stoppropagation(); is used stop event bubble in dom tree not execute event bound on parent elements. in case not happening seems me form getting submitted.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -