aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-16 18:41:10 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-16 18:41:10 +1300
commit234b9aa67a8ba16d30cdaaac6aeb35562e0d7353 (patch)
tree0305c955ef5f2c23ccff34ca2898ad170a343b75 /web
parent37d91fdce003cc0e82bc6c3c1f7ee64c63fde1f8 (diff)
downloadtrackermap-web-234b9aa67a8ba16d30cdaaac6aeb35562e0d7353.tar.gz
trackermap-web-234b9aa67a8ba16d30cdaaac6aeb35562e0d7353.tar.bz2
trackermap-web-234b9aa67a8ba16d30cdaaac6aeb35562e0d7353.zip
Keep service session cookie
Diffstat (limited to 'web')
-rw-r--r--web/simple/app.js15
-rw-r--r--web/simple/index.html4
2 files changed, 10 insertions, 9 deletions
diff --git a/web/simple/app.js b/web/simple/app.js
index 19c4de59..5ae8ac2c 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) {
diff --git a/web/simple/index.html b/web/simple/index.html
index 08c9b2bb..d4bfe504 100644
--- a/web/simple/index.html
+++ b/web/simple/index.html
@@ -4,11 +4,11 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Traccar</title>
-<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.css" type="text/css">
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.css" type="text/css">
</head>
<body style="margin: 0; padding: 0;">
<div id="map" style="width: 100%; height: 100%; position:fixed;"></div>
-<script src="//cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.js" type="text/javascript"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.js" type="text/javascript"></script>
<script id="loadScript" src="app.js"></script>
</body>
</html>