1
How do I take the value of a tag when I double-click it and take that value and move to a method in my controller. Double click function is working.
$('#nmUsuario').on("dblclick", '.clique', function() {
CarregaDados();
})
Where nmUsuario is the tbody of my table. My method CarregaDados();
is where I want to take the value of the tag clicked and move to the controller via json.
function CarregaDados() {
$('.rowid').find('td').each(function () {
var test = $(this).text();
alert(test);
})
$.ajax({
url: '/CadastroAcesso/CarregaDadosPagina',
datatype: 'json',
contentType: 'application/json;charset=utf-8',
type: 'POST',
data: JSON.stringify({ aqui não sei o que passar }),
success: function (data) {
alert('Alô, tudo bem?');
},
error: function (error) {
}
})
}
Where rowid is mine <TR>
, however, as I just want to get the tag clicked, it makes sense to make a each? The code I made before ajax, does not enter Alert. I don’t know the test value.
public JsonResult CarregaDadosPagina(string _nivel, string _nome, string _usuario)
{
RupturaEntities db = new RupturaEntities();
//var result_carrega_pagina = db.
return Json(new { }, JsonRequestBehavior.AllowGet);
}
What does the controller expect to receive? A string list?
– Filipe Oliveira
I will edit and display my controller method. It is a string parameter.
– pnet
It would be interesting to add your HTML.
– Renan