jQuery function does not work

-3

I'm doing a function with jQuery, but it does not work, that is, it does not arrive in my controller, someone could help me please, follow the code:

var Aprovar = function () {
    $.ajax({
        url: 'GerenciaPassagem/AprovarPassagem',
        type: 'POST',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: JSON.stringify({ mes: $("#ListaPeriodo").val() }),
        success: function (data) {
            $("#tabFiltra").html(data);
            drawTable();
        },
        beforeSend: function () {
            $.blockUI({ message: '<img src="' + url + '/Content/ajax-loader.gif" alt="Aguardando..."/>' });
        },
        complete: function () {
            $.unblockUI();
        },
        error: function (a, b, c) {
            var x = a;
        }
    });
}

HTML

<input type="button" value="Aprovar" id="btAprovar" onclick="listaPassagens(); return false;" style="margin-left: 9px;" /> @*onclick="Aprovar(); return false;"*@
    
asked by anonymous 11.04.2014 / 14:40

1 answer

3

If I understand correctly, what do you want to do is call that function when you click the correct button?

If yes, the code looks like this:

Switch var Aprovar = function () {

by: function listaPassagens(){ /* Nome que você já utilizou */

The button will have to have this:

<intput type="button" onclick="javascript: listaPassagens();"

Or add the line in your js and remove the button calls:

$("#btAprovar").click( function(){ listaPassagens() } );

I hope I have helped.

    
11.04.2014 / 19:02