I am trying to get the data attribute of a button with id delete_btn and send it through ajax. As a result, I am getting the following error.
Uncaught TypeError: Illegal invocation
JQuery
var id = $( "#delete_btn").attr('data-identifier');
$.ajax({
dataType: "json",
url: apiURL,
data: { 'req': 'delete', 'id': id},
success: function(data){
// do something
},
error: function (textStatus){
//do something
}
});
I have even tried getting the attribute value by
$( "#delete_btn" ).data( "identifier")
But got the same error
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire