<html>
<head>
<script> src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
</script>
<script>
/*$(document).ready(function(){
$("p").click(function(){
event.preventDefault()
$.post("/response.php",
{
name: "Donald Duck",
city: "Duckburg"
},
);
});
});*/
$(document).ready(function(){
$("p").click(function(){
event.preventDefault();
$.ajax({
type: "POST",
url: "/response.php",
data: {name: "Donald Duck", city: "Duckburg"},
cache: false,
success: function(html){
$(".make").html(html);
}
});
});
});
</script>
</head>
<body>
<form action="http://localhost/response.php" />
<p><input type="submit" value="Send an HTTP POST request to a page and get the result back"></p>
</form>
</body>
</html>
hi, I tried to learn the ajax to send data from client(js, html) to server(php), I tried ajax. post(), but it seems to work like load data from the server, so how to make it work to send data to server?