I have an image slider and every time the next image is loaded I need to save a record to the database. I am trying to accomplish this using jQuery and AJAX.
I write the info I need to a hidden field called data so I can post it to my PHP page.
function ajaxSave(){
$("#data").val($("#image").attr("src")+","+ratings[iCount]);
//alert($("#data").val());//Testing
$.ajax({
type: "POST",
url: "ajax/ajaxSave.php",
data: $("#data").val(),
success: function(data){
alert(data);//only for testing purposes
}
});
}
I call my ajaxSave() function every time the next button is pressed. I get my alert that was successful but my question is: What is the $_POST[”] array cell for this?
I need to manipulate the data in the php page (see below), but I only get an alert that says “array ( )”.
<?php
print_r($_POST);
?>
I’m very new to AJAX so any help would be greatly appreciated! Thanks.
The data for the Ajax should be sent as a map..
So instead of
Try