0

I need to change the following script from a submithandler to an onchange event

I have a form with a select (list) that currently works on a submit button. and loads the results into a div. I need this form to submit when a user selects from the list box and do everything else the same as shown

$(document).ready(function(){
$("#viewCus").validate({
debug: false,
submitHandler: function(form) {
  $.post('customers_view.php', $("#viewCus").serialize(), function(data) {
    $('#mainBody').html(data);
    ////////This executes the JavaScript passed back by the ajax.
    $("#mainBody").find("script").each(function(i) {
      eval($(this).text());
    });
    ////////*$("form#ncus")[0].reset();*/
  });
}
});
});

Many thanks :)

4

1 回答 1

0
$('select').change(function(e)
{
   // do your operation here
   $(form).submit();
});
于 2013-10-01T21:13:00.293 回答