I have a simple form with one select box and two options in it. Here is the related jQuery code:
$('.myCssClass').on('change', function() {
alert("This is executed");
$(this).parent().submit(function(e) {
alert("This is NOT executed");
$.ajax({
type: "POST",
url: "script.php",
data: $(this).parent().serialize(),
success: function(data)
{
alert(data);
}
});
e.preventDefault();
});
Form is a parent of a select box. So the first alert is executed when I change the select box option, but then next one is never reached. Any idea why?
submit
button.