Good day,
I am confused as to when I am using VBScript, Javascript, and JScript inside classic ASP.
I've been told that our environment uses JScript by default.
So when we create a blank page with our company's standard includes, we just start coding in JScript.
Now I wish to use the json2.js file so that I can parse incoming JSON and send JSON out to clients/browsers.
I didn't think that I needed to do anything special to use json2.js since it's pure javascript. But I'm having issues placing the SCRIPT tag. Basically when and where do I need a new SCRIPT tag inside a classic ASP page?
I am getting a 'JSON' is null or not an object' response. That leads me to believe that the JSON.parse() method is not even being recognized.
Thanks
<script language="javascript" runat="server" src="json2.js"></script>
<%
.... ..... some ASP Code in JScript
%>
<script language="javascript" runat="server">
var lngBytesCount
lngBytesCount = Request.TotalBytes
var requestBody = BytesToStr(Request.BinaryRead(lngBytesCount));
//var jsonObject=JSON.parse(\"{"answer":"ok"}\");
var jsonObject=JSON.parse(requestBody);
Response.ContentType = "application/json";
for (var i in jsonObject){
Response.Write(jsonObject[i]);
}
//var json = eval(requestBody);
//Response.Write(json);
Response.End()
</script>
<%
.... ..... some ASP Code in JScript