Warning: Can't use blame annotator:
svn blame failed on trunk/webapps/common/js/fileutils.js: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator/trunk/webapps/common/js/fileutils.js @ 442

Revision 442, 919 bytes checked in by jdalbey, 7 years ago (diff)

minor formatting improvements to unified log monitor

RevLine 
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        if (inFile.endsWith(".csv"))
12        {
13            xobj.overrideMimeType("text/csv");
14        }
15        xobj.open('GET', inFile, true);
16        xobj.onreadystatechange = function()
17        {
18            if (xobj.readyState == 4 && xobj.status == "200")
19            {
20                callback(xobj.responseText);
21            }
22        };
23        // We want ajax to ignore any cached responses
24        xobj.setRequestHeader('If-Modified-Since', 'Sat, 01 Jan 2000 01:01:01 GMT')
25        xobj.send(null);
26    }
27
Note: See TracBrowser for help on using the repository browser.