foreach loop
AJAX
form
foreach
<form class="upVote" action="../inc/handlers/up-vote.php" method="post"> <input type="hidden" name="plus" value="'.$postIdentifier[$commentID].'" /> <button id="plus" type="submit" value="'.$postIdentifier[$commentID].'" ></button></form>
$(document).ready(function(){ $(".upVote").submit(function(){ var plus = $(this).val(); $.ajax({ url: "../inc/handlers/up-vote.php", data: $(".upVote").serialize(), type: "POST", dataType: 'json', success: function (e) { console.log(JSON.stringify(e)); }, error:function(e){ console.log(JSON.stringify(e)); console.log('error'); } }); return false; }); });
$_POST['plus'];
upVote
data: $(this).serialize(),
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)