diff options
Diffstat (limited to 'web/simple')
-rw-r--r-- | web/simple/app.js | 15 | ||||
-rw-r--r-- | web/simple/index.html | 4 |
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> |