I need to send some data stored in IndexedDB to server for some back-end manipulation. The needed data is fetched to a variable payLoad
in javascript using JSON.stringify()
.
payLoad = "[{"synch":0,"id":-1,"name":"Tester","email":"test@example.com","created":"2014-08-20T07:56:44.201Z"}]";
$.ajax({
type: "POST",
url: "process.php",
data: payLoad, // NOTE CHANGE HERE
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert(msg);
},
error: function(msg) {
alert('error');
}
});
Can I parse this JSON data to a PHP class?