-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.html
38 lines (32 loc) · 807 Bytes
/
ajax.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!doctype html>
<html>
<head>
<title>Learn JS</title>
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery.js"></script>
<script>
$(function() {
// $.get('ajax/call.php?name=Jesse', function(resp) {
// alert(resp);
// });
// var data = {name: 'Benny'};
// $.post('ajax/call.php', data, function(resp) {
// console.log(resp.name);
// }, 'json');
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/call.php',
data: {name: 'Smith'},
success: function(resp, txt, xhr) {
console.log(resp.name);
},
error: function() {
}
});
});
</script>
</head>
<body>
</body>
</html>