peerlink
This commit is contained in:
commit
fabac5da4a
16 changed files with 1194 additions and 0 deletions
32
example/static/index.html
Normal file
32
example/static/index.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title></title>
|
||||
<style>
|
||||
</style>
|
||||
<script src="https://oxjs.org/build/Ox.js"></script>
|
||||
<script>
|
||||
Ox.load(function() {
|
||||
var app = window.app = {};
|
||||
app.request = function(action, data, callback) {
|
||||
data = JSON.stringify(data);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/' + action, true);
|
||||
xhr.onload = function() {
|
||||
var response = JSON.parse(this.response);
|
||||
callback(response)
|
||||
};
|
||||
xhr.onerror = function(error) {
|
||||
callback(null, error);
|
||||
}
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.send(data);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue