aboutsummaryrefslogtreecommitdiff
path: root/web/simple/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/simple/app.js')
-rw-r--r--web/simple/app.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/web/simple/app.js b/web/simple/app.js
index 19c4de5..5ae8ac2 100644
--- a/web/simple/app.js
+++ b/web/simple/app.js
@@ -51,17 +51,18 @@ var map = new ol.Map({
});
var ajax = function (method, url, callback) {
- var x = new XMLHttpRequest();
- x.open(method, url, true);
- x.onreadystatechange = function () {
- if (x.readyState == 4) {
- callback(JSON.parse(x.responseText));
+ var xhr = new XMLHttpRequest();
+ xhr.withCredentials = true;
+ xhr.open(method, url, true);
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == 4) {
+ callback(JSON.parse(xhr.responseText));
}
};
if (method == 'POST') {
- x.setRequestHeader('Content-type', 'application/json');
+ xhr.setRequestHeader('Content-type', 'application/json');
}
- x.send()
+ xhr.send()
};
ajax('GET', url + '/api/session?token=' + token, function(user) {