I'm currently working on a feature that updates my database when a user clicks a specific link. Each link has a different value - for example, one increases by 1, another by 2, and so forth.
My goal is to submit a form to a separate page with the data from #form
, alongside a variable appended to it. However, I'm encountering issues with this function not functioning correctly.
JavaScript
function update_number(x) {
$.ajax({
type: "POST",
url: "update_likes.php",
data: $("#Form"+x).serialize(),
dataType: "json",
return false;
};
HTML
<input type='image' src='...' onclick'update_number(2);' />
Any assistance would be greatly appreciated.