Rookie for advice
Use $.ajax to submit,
$.ajax({ type: "POST", url: 'getData.php', async: false, data: $('#guestbook').serialize(), error: function(XMLHttpRequest, textStatus, errorThrown) { alert(XMLHttpRequest.status); alert(XMLHttpRequest.readyState); alert(textStatus); }, success: function(data){ alert(data); } })
The serialized value obtained in the background is in the form ofname1=value1&name2=value2&name3=value3
...
$data = file_get_contents("php://input"); $str = urldecode($data);
How to convert the obtained data into an array or json, and the key value corresponds
parse_str