jQuery.ajax sintax
// exemplo 1
$.ajax({ // create an AJAX call...
data: $(this).serialize(), // get the form data
type: $(this).attr('method'), // GET or POST
url: $(this).attr('action'), // the file to call
success: function(response) { // on success..
$('#clientelst').html(response); // update the DIV
$("#frmConsulta #edtPage").val(1);
$("#tblCliente .overlay").hide();
},
error: function(){
$("#tblCliente .overlay").hide();
}
});
// exemplo 2
$.ajax({
url: Controller + 'gerabairro/',
type: 'POST',
data: {Bairro: Bairro, CidadeColeta: CidadeColeta},
})
.done(function() {
$("#BoxMsg .text-body").text('Lista de bairros criada com sucesso!');
console.log("success");
})
.fail(function() {
$("#BoxMsg .text-body").text('Erro ao criar a lista de bairros!');
console.log("error");
})
.always(function() {
$("#BoxMsg").fadeIn(300).delay(1000).fadeOut(400);
console.log("complete");
});