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

Revision 315, 698 bytes checked in by jdalbey, 7 years ago (diff)

move images to webapps folder

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        xobj.overrideMimeType("application/json");
7        xobj.open('GET', inFile, true);
8        xobj.onreadystatechange = function()
9        {
10            if (xobj.readyState == 4 && xobj.status == "200")
11            {
12                callback(xobj.responseText);
13            }
14        };
15        // We want ajax to ignore any cached responses
16        xobj.setRequestHeader('If-Modified-Since', 'Sat, 01 Jan 2000 01:01:01 GMT')
17        xobj.send(null);
18    }
Note: See TracBrowser for help on using the repository browser.