Changeset 426 in tmcsimulator for trunk/webapps/cptms/js/harLayer.js


Ignore:
Timestamp:
06/26/2019 02:00:51 PM (7 years ago)
Author:
jdalbey
Message:

cmsLayer.js, harLayer.js updated to fix #107.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/cptms/js/harLayer.js

    r413 r426  
    113113        } 
    114114        harLayer.overrideStyle(harLayer.getFeatureById(harID), currentIcon) 
    115         // convert messasge to json string  
    116         jsonstring = JSON.stringify(Object.values(HARmessageDict)); 
    117         outString = "{\"data\":" + jsonstring + "}"; 
    118115 
    119         //var xhttp = new XMLHttpRequest(); 
    120         //xhttp.open("GET", "../cgi-bin/saveHARmessage.py?msg=" + outString, true); 
    121         //xhttp.send(); 
     116        // Examine each message in the dict and convert to json format 
     117        var lineOut = ""; 
     118        for (var id in HARmessageDict) 
     119        { 
     120            // convert and append to output string 
     121            lineOut += JSON.stringify(HARmessageDict[id]) + ',\n'; 
     122        } 
     123        // remove trailing comma 
     124        lineOut = lineOut.substring(0,lineOut.length-2); 
     125        outString = "{\"data\":[\n" + lineOut + "\n]}"; 
     126 
    122127        // Using POST to send the data  
    123128        var xhr = new XMLHttpRequest(); 
Note: See TracChangeset for help on using the changeset viewer.