I have a php file where user will fill the form and the form data will be send to the backend php file in JSON format but i am unable to retrieve the JSON data send to the php file
// DATA SENDING ...
$(document).ready(function () {
$('#submit').click(function () {
var name, id, sec, base;
name = $('#name').val();
id = $('#id').val();
sec = $('#pay').val();
base = [{name: name, reg: id, sec: sec}];
$.ajax({
url: '/post/json.php',
type: 'POST',
data: JSON.stringify(base),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
async: false,
success: function (json) {
//do something ... after the data successfully processed via json.php
}
}
});
});
});
i tried to write the php as simple file to get query string and echoing it but nothing happen ... but if i POST simple query string (via jQuery) then its echoing
// PHP BACKEND
<?php
$ar= $_SERVER['QUERY_STRING'];
echo $ar;
?>