I need your help. How do I go about accessing my JSON data that my ASP sub has created and use it in a Javscript enviroment? My goal is to eventually use the JSON data to render a datatable. I unsure as to how to access the ASP variable JSON using javascript to manipulate the data later.
Here is the code that is working:
<%
sub search
Dim cn
Dim rs
Dim sSQL
Dim JSON
set cn = Server.CreateObject("ADODB.Connection")
cn.Open "ConnectionString"
sSQL = "SELECT * FROM tbl_offices"
set rs = cn.Execute(sSQL)
JSON = RStoJSON(rs)
response.write(JSON)
response.flush
rs.Close
set rs = nothing
cn.close
set cn = nothing
end sub
%>
I'd like to access the stored JSON data in my Dim JSON using JavaScript
<form name="GO" method="post">
<input type="text" name="Search" class="input_txt_search" />
<input type = "submit" name="GO" value="GO"/>
</form>
<%
if Request.Form("GO") = "GO" then
search
End If
%>
You can output the JSON like this to be used in the html later:
response.write("<script>")
response.write("var obj = " & JSON)
response.write("</script>")