File size: 622 Bytes
27867f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$(document).ready(setTimeout(function(){
    $('form').submit(function(e) { // catch the form's submit
        // ajax does not submit name/value of button, so use hidden input
        $('input:hidden[name=action]').val(e.originalEvent.submitter.value);
        $.ajax({
            data: $(this).serialize(),
            type: $(this).attr('method'), // GET or POST
            url: $(this).attr('action'),
            success: function(response) { // on success
                $('#menuActionStatus').html(response);
            }
        });
        return false; // cancel original submit event
    });
    
}, 500));