example
This commit is contained in:
parent
536a99ed22
commit
d8f5ce5675
8 changed files with 382 additions and 105 deletions
|
|
@ -4,29 +4,21 @@
|
|||
<meta charset="utf-8" />
|
||||
<title></title>
|
||||
<style>
|
||||
#messages {
|
||||
}
|
||||
</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>
|
||||
<script src="http://localhost/oxjs/build/Ox.js"></script>
|
||||
<script src="/chat.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
Nick: <input id="nick" type="text"></input>(<span id="id"></span>)<br>
|
||||
Peers:
|
||||
<div id="peers"></div>
|
||||
<textarea id="message" type="text"></textarea><br/>
|
||||
<input id="send" type="button" value="Send"></input>
|
||||
<br>
|
||||
Message:<br/>
|
||||
<div id="messages"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue