Post Json String Get Null
I have converted all the entries of a form into an object and then fill it using the object to fill an array: var jsonObj = []; var formData = new FormData(); $('[name=''+form+'']
Solution 1:
Simpler way to send json is:
$.ajax({
url: url,
data: jsonData, // stringified JSONcontentType: 'application/json',
// processData: false,type: 'POST',
//cache: false, POST won't cacheerror: function(xhr, status, error) {
alert(error);
},
success: function(response) {
alert(response);
}
});
And receive in php
$data = json_decode(file_get_contents('php://input')[,boolean to force array]);
Easiest way to send data in general is to use serialize()
on form and send as default content type and receive various fields as $_POST[inputName]
Post a Comment for "Post Json String Get Null"