I'm attempting to send JSON data to a ColdFusion document that will process the data, but I'm hitting a brick wall.
The data is too long to run as a GET. I've tried setting it up as a POST, but nothing is being submit to the .cfm file (nothing shows up in the form scope.)
I'll try to type as much of the code as I can.
Now, in the ColdFusion document all I'm doing is a CFDUMP (raw data dump) of the form scope. So, reportText should be that. But it's coming up blank. Empty. Nothing.Code:xhr = new XMLHttpRequest(); xhr.open("POST","/path/to/document.cfm",false); xhr.setRequestHeader("Content-type","x-www-form-urlencoded"); xhr.setRequestHeader("Content-length",JSON.stringify(finalarray).length + 9); xhr.setRequestHeader("Connection","close"); xhr.send('thisData=' + JSON.stringify(finalarray)); var reportText = xhr.responseText;
How can I send a JSON string via xhr without using a form?