I have a form that can delete records from a MySql database using ajax and jQuery. I\'m trying to get the jQuery to only select the relevant record passed to it and not just
I would recommend you to use data-*
prefixed attributes to persists your data.
HTML
Then you can fetch it using .data(key)
Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute
Script
//Delete Review
$(document).ready(function(){
//Need to get $id here.
$(".deleteReview").click(function (e) {
e.preventDefault();
var username = $(this).data("username");
var film_id = $(this).data('filmid');
var id = $(this).data('id');
......
return false;
});
});