I have a array variable in jQuery which is created as follows:
var values = $('input:checked').map(function() {
return this.value;
}).get();
Assume the values in the array variable as 1,2,3. I am trying to pass this variable to php using the below ajax call:
doAjaxCallDelete("delete_checked", "values");
The ajax function is written as below:
function doAjaxCallDelete(mode, values) {
$.ajax({
url: ajaxURL,
type: "post",
data: {mode: mode, values: values},
async: false,
success: function(data){
responseData = data;
},
error:function(){
alert('Connection error. Please contact administrator. Thanks.');
}
});
return responseData;
}
I am retrieving this value in php using:
$myArray = $_REQUEST["values"];
But when I echo $myArray
its showing 'values' instead of the real values inside the variable.
Can anybody suggest a solution to pass values of the array variable properly. Thanks in advance.