I can not get ajax success with this function. The function works, that is, it calls the double click. The first alert is ok, but the second is not triggered.
$('#nmUsuario').on("dblclick", '.clique', function() {
alert('Alô, tudo bem?');
var obj = {};
$('tr').each(function () {
obj = {
_nivel: $(this).find('td').eq(0).text,
_nome: $(this).find('td').eq(1).text,
_usuario: $(this).find('td').eq(2).text
}
})
$.ajax({
url: '/CadastroAcesso/CarregaDadosPagina',
datatype: 'json',
contentType: 'application/json;charset=utf-8',
type: 'POST',
data: obj,
success: function(data){
alert('Alô, tudo bem 1?');
},
error: function(error){
}
})
})
Doing my tests, I saw that this is wrong:
$('tr').each(function () {
obj = {
_nivel: $(this).find('td').eq(0).text,
_nome: $(this).find('td').eq(1).text,
_usuario: $(this).find('td').eq(2).text
}
})