I am writing a node.js application and am a little worried about how I create mail data to send to the server. For example, when I want to delete a data item, I put the identifier of the specified item in the href attribute:
<a class='delete' href="1231">Delete this data</a>
When I click this link, I prevent the default actions and then run the ajax request:
body.on('click', '.delete', function(e){
e.preventDefault();
$.ajax({
type: 'POST',
url: '/admin/report/detail/delete',
data: {id: $(this).attr('href')},
success: function(){
},
error: function(){
}
});
});
I am wondering if it is bad practice to use the href attribute in this way? If so, what is the best way to store this data?
source
share