I have written front end simple login application using Jquery, ajax and json, I want to send json information to php and it has to retrieve the data of json and if successful it has to redirect to another page, Here is the simple front end code I am using.
!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="login.css">
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$("#submit").on('click',function(){
var person={
user:$("#user").val(),
pass:$("#pass").val(),
}
$.ajax
({
type: "POST",
url: '/test/login.php',
dataType: 'json',
async: false,
data: person,
success: function () {
}
})
});
});
</script>
</head>
<body>
<div id="loginstyle">
<form action="login.php" method="post">
<table>
<tr>
<td>
Email:</td><td><input type="email" name="email" id="user" ></td>
<tr><td>Password:</td><td><input type="password" name="password" id="pass"><td></tr>
</table>
<input type="submit" value="submit" id="submit">
</div>
</form>
</body>
</html>
Can anybody suggest me how to decode the json data and print the user and pass in login.php