-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjson_example.html
30 lines (30 loc) · 1 KB
/
json_example.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
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type'>
<title>turbowebdis</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function()
{
$('button').on('click', function()
{
$.ajax({
'type' : 'POST',
'dataType' : 'JSON',
'contentType' : 'application/json',
'url' : 'http://localhost:8888/',
'data' : JSON.stringify({"auth": "foobar", "db": 1, "command": ["SET", "SOME", "VALUE"]}),
'success' : function(response)
{
console.log(response);
document.write(JSON.stringify(response));
}
});
})
});
</script>
</head>
<body>
<button>make request</button>
</body>
</html>