请告诉我代码中的确切错误。
这是我的代码,
的index.php
<!DOCTYPE html> <html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<title></title>
<script>
$(document).ready(function(){
$("#formSubmit").click(function(){
var name = $("#name").val();
var password = $("#password").val();
$.ajax({
type: "POST",
url: "request.php",
data : "username="+name+"&Password="+password,
success: function(msg,string,jqXHR)
{
$("#results").html(msg.name+'<br>'+msg.password);
}
});
});
});
</script>
</head>
<body>
<form>
Enter Name : <input type="text" name="name" id="name">
Enter Password : <input type="password" name="password" id="password">
<input type="button" name="submit" id="formSubmit" value="Click">
</form>
<div id="results"></div>
</body> </html>
request.php
<?php
$name = $_REQUEST['name'];
$password = $_REQUEST['password'];
$list = array('name' => $name, 'password'=> $password);
$output = json_encode($list);
echo $output;
?>
请参阅附图