How to send Json object (or string data) from xmlhttprequest using Classic ASP? How to send Json object (or string data) from xmlhttprequest using Classic ASP? json json

How to send Json object (or string data) from xmlhttprequest using Classic ASP?


Here is some code I published before at this URL adapted for your situation:

http://naterice.com/articles/69

strJSONToSend = theevent webserviceurl = "http://thedomain.com/api/push"sResponseHTML = GetHTTP(strJSONToSend, webserviceurl)If len(HTTPErrorHandeler) > 0 Then  strResponse = HTTPErrorHandelerElse  strResponse = sResponseHTMLEnd IfResponse.Write strResponseFunction GetHTTP(sSendHTML, sURL)  'This script is provided under the Creative Commons license located'  'at http://creativecommons.org/licenses/by-nc/2.5/ . It may not'  'be used for commercial purposes with out the expressed written consent'  'of NateRice.com'  Set oHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")  oHTTP.Open "POST", sURL, false  oHTTP.setRequestHeader "Content-Type", "application/json; charset=UTF-8"   oHTTP.setRequestHeader "HTTP_TOKENKEY","ABCDEFGHIJKLMNOPQ"   oHTTP.setRequestHeader "SOAPAction", webserviceurl  On Error Resume Next  oHTTP.send sSendHTML  sHTTPResponse = oHTTP.responseText  If Err.Number = 0 Then    GetHTTP = sHTTPResponse  Else    GetHTTP = HTTPErrorHandeler  End If  On Error Goto 0  Set oHTTP = NothingEnd FunctionFunction HTTPErrorHandeler  'This script is provided under the Creative Commons license located'  'at http://creativecommons.org/licenses/by-nc/2.5/ . It may not'  'be used for commercial purposes with out the expressed written consent'  'of NateRice.com'  If Err.Number <> 0 Then  HTTPErrorHandeler = "ERROR <br />" & _             "  ERR Number: " & Err.Number & " <br />" & _             "  ERR Description: " & Err.Description  Else  HTTPErrorHandeler = ""  End IfEnd Function