I am using the following jquery ajax call:
$(document).ready(function () {
submitAct();
function submitAct(){
var alldata = [];
alldata.push( {
"pid": 'd2a7d886-6821-3eaa-079f-fbe278c6a16a',
"title": 'Fun with Gophers',
});
$.ajax({
dataType: "jsonp",
type: 'POST',
url: '//[server path]/act',
data: "data=" + JSON.stringify(alldata),
});
}
});
On the server, the result of $_POST[data] is showing as:
[{"pid":"d2a7d886-6821-3eaa-079f-fbe278c6a16a","title":"Fun with Gophers"}]
I am having trouble accessing the keys and related values of 'pid' and 'title'. Would someone please provide some insight? I've tried things like below but haven't had any success:
$_POST['title']
$data = json_decode( $_POST['data']);
$data->title
Thanks!
var_dump($data)?