I'm new to AJAX, and can't get a php function to run.
The AJAX post request is working as it should, here's the code:
function thumbs(i) {
$('.thumbs-up' + String(i)).click(function(){
$(this).addClass('up');
$.ajax({
type:"POST",
url:"item.php",
data:'act=up&function' + String(i) + '=true&user=' + email,
success: function(){
}
});
});
for (var i = 1; i <= count; i++) {
thumbs(i);
}
The above works, I receive all the correct values.
Then the PHP code that should run is here:
for ($i = 1; $i <= $count; $i++) {
if ($_POST['function' . $i] == 'true') {
//code that should run but does not
}
}
The count variable is the same. Is there anything wrong here?