I have function:
function delMeh() {
console.log('prolazi klik');
var did = $(this).attr('data-value');
$.ajax({
url: "delTmeh.php",
type: "POST",
async: true,
data: { vrednostid:did}, //your form data to post goes here as a json object
dataType: "html",
success: function(data) {
$('#tablemeh').dataTable().fnDestroy();
drawMeh();
},
error: function(data) {
console.log(data);
}
});
}
and HTML:
<i data-value="32" onclick="delMeh();" class="fa fa-times delMeh"></i>
SO, on click I need to delete row 32 from database, but how I can get data-value of clicked element...
I try with:var did = $(this).attr('data-value');
inside delMeh() function but dont work.
How to get attr data-value of clicked element when call function like I need to do?