I m posting an array along with a variable in ajax like
$.post(pageURL,{data:data,id:linkid},function showData(Data)
{
})
at pageURL the data object is accessible but the id is missing . I tried pushing that id in data array like
data['id']=linkid
but still i cant manage to get that id at pageURL (though i can see that "id" posted in my call header). On pageURL i am trying to get values using print_r($_REQUEST['data']['id']);
You should add id in your data object. like this
data['id']=linkid
Then post it in ajax request.
$.post(pageURL, { data: data }, function showData(Data) {
});
Then you will be able to access it using data object.
$_REQUEST[data[id]]'
Complete code.
data.id = linkid;
$.post(pageURL, { data: data }, function showData(Data) {
})
To get the id you simply do
print_r($_POST['id']);
if this doesn't work you can try to change the name of the value
{data:data,linkid:linkid}
print_r($_POST['linkid']);
Try to access $_POST['data']['id']
i don't know why but just shuffling the places like
$.post(pageURL,{id:linkid,data:data},function showData(Data)
{
})
solved the issue. if anybody can explain why it solved like this it would be helpful. Thanks