33 lines
900 B
HTML
33 lines
900 B
HTML
|
<!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>
|
||
|
|