source: tmcsimulator/trunk/webapps/js/common.js @ 348

Revision 348, 952 bytes checked in by jdalbey, 7 years ago (diff)

Added gotoxmltime.html and other prototypes for ei notebook. They can be removed when no longer needed.

Line 
1    // Load the dynamic json file for highways, etc.
2    // Ref: https://codepen.io/KryptoniteDove/post/load-json-file-locally-using-pure-javascript
3    function loadJSON(inFile, callback)
4    {
5        var xobj = new XMLHttpRequest();
6        // Assume XML unless filename ends with .json
7        if (inFile.endsWith(".json"))
8        {
9            xobj.overrideMimeType("application/json");
10        }
11        xobj.open('GET', inFile, true);
12        xobj.onreadystatechange = function()
13        {
14            if (xobj.readyState == 4 && xobj.status == "200")
15            {
16                callback(xobj.responseText);
17            }
18        };
19        // We want ajax to ignore any cached responses
20        xobj.setRequestHeader('If-Modified-Since', 'Sat, 01 Jan 2000 01:01:01 GMT')
21        xobj.send(null);
22    }
23
24
25    function handleDialogClose(id)
26    {
27        // hide the display
28        document.getElementById(id).style.display = 'none'
29    }
30
31
Note: See TracBrowser for help on using the repository browser.