javascript - Submitting form with ajax and jQuery -


i have simple form 1 select box , 2 options in it. here related jquery code:

 $('.mycssclass').on('change', function() {        alert("this executed");        $(this).parent().submit(function(e) {        alert("this not executed");           $.ajax({                  type: "post",                  url: "script.php",                  data: $(this).parent().serialize(),                   success: function(data)                  {                      alert(data);                  }                });           e.preventdefault();       }); 

form parent of select box. first alert executed when change select box option, next 1 never reached. idea why?

this should it. don't bother submit event - not triggered select box.

 $('.mycssclass').on('change', function() {       $.ajax({              type: "post",              url: "script.php",              data: $(this).parent().serialize(),               success: function(data)              {                  alert(data);              }       });   }); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -