peerlink/example/static/index.html

33 lines
900 B
HTML
Raw Normal View History

2014-08-26 19:07:33 +00:00
<!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>