forked from CloakProject/CloakCoin
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrpc-server-test.html
42 lines (36 loc) · 901 Bytes
/
rpc-server-test.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
39
40
41
42
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){
function make_base_auth(user,password){
var tok = user + ':' + password;
var hash = btoa(tok);
return 'Basic '+hash;
}
$.ajaxSetup({
beforeSend: function(xhr){
xhr.setRequestHeader('Authorization', make_base_auth('test','test'));
}
});
$.ajax({
url: 'http://test:test@127.0.0.1:29661',
type: 'POST',
contenType: 'application/json',
cache:false,
dataType:"json",
data: '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }',
timeout: 15000,
})
.done(function(msg){
$('#content').html(JSON.stringify(msg));
});
});
</script>
</head>
<body>
<div id='content'>content</div>
</body>
</html>