Changeset 413 in tmcsimulator for trunk/webapps/cptms/js


Ignore:
Timestamp:
05/21/2019 07:53:16 AM (7 years ago)
Author:
jdalbey
Message:

cmsLayer.js,harLayer.js modified to use POST requests

Location:
trunk/webapps/cptms/js
Files:
2 edited

Legend:

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

    r400 r413  
    159159        jsonstring = JSON.stringify(Object.values(messageDict)); //Can't use these in GET parameter  ,null,4); 
    160160        outString = "{\"data\":" + jsonstring + "}"; 
    161         console.log("outString = " + outString); 
    162         var xhttp = new XMLHttpRequest(); 
    163         xhttp.open("GET", "../cgi-bin/saveCMSmessage.py?msg=" + outString, true); 
    164         xhttp.send(); 
    165         console.log("status code: " + xhttp.status); 
    166         // Using POST might be a better idea ... haven't tried this yet 
    167         //      var xhr = new XMLHttpRequest(); 
    168         //      xhr.open("POST", "/cgi-bin/saveCMSmessage.py?", true); 
    169         //      xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); 
     161        //console.log("outString = " + outString); 
     162        //var xhttp = new XMLHttpRequest(); 
     163        //xhttp.open("GET", "../cgi-bin/saveCMSmessage.py?msg=" + outString, true); 
     164        //xhttp.send(); 
     165        //console.log("status code: " + xhttp.status); 
     166        // Using POST to send the data  
     167        var xhr = new XMLHttpRequest(); 
     168        xhr.open("POST", "../cgi-bin/saveCMSmessage.py", true); 
     169        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 
    170170        // send the collected data as JSON 
    171         //      xhr.send(JSON.stringify(messageList)); 
     171        xhr.send("msg="+outString); 
    172172    } 
    173173 
  • trunk/webapps/cptms/js/harLayer.js

    r400 r413  
    117117        outString = "{\"data\":" + jsonstring + "}"; 
    118118 
    119         var xhttp = new XMLHttpRequest(); 
    120         xhttp.open("GET", "../cgi-bin/saveHARmessage.py?msg=" + outString, true); 
    121         xhttp.send(); 
    122         // Using POST might be a better idea ... haven't tried this yet 
    123         //      var xhr = new XMLHttpRequest(); 
    124         //      xhr.open("POST", "/cgi-bin/saveMessage.py?", true); 
    125         //      xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); 
     119        //var xhttp = new XMLHttpRequest(); 
     120        //xhttp.open("GET", "../cgi-bin/saveHARmessage.py?msg=" + outString, true); 
     121        //xhttp.send(); 
     122        // Using POST to send the data  
     123        var xhr = new XMLHttpRequest(); 
     124        xhr.open("POST", "../cgi-bin/saveHARmessage.py", true); 
     125        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 
    126126        // send the collected data as JSON 
    127         //      xhr.send(JSON.stringify(messageList)); 
     127        xhr.send("msg="+outString); 
    128128    } 
    129129 
Note: See TracChangeset for help on using the changeset viewer.