I had a classic ASP page (VBscript) that generates an XML on server-side, and then Response.Writes it. The page had no client side at all.
However I needed to convert it to JSON. Since I could not find an ASP server-side way that worked (whole different subject) I did it on client-side with a Javascript code I found, finally document.writing it to the page.
THE PROBLEM is that the result is not the same: If before the http RESPONSE was only an XML, the response now is the javascript code, which writes to the browser the JSON , but not to the response. Am I understanding this right?
In other words, if before I had an xml as the response, now the response is this:
<script type="text/javascript">
var xmlObj = parseXml('<%=resultXml%>');
var json = xml2json(xmlObj);
document.write(json);
</script>
This whole block is called by the ASP inside a method like this:
sub writeJsonResult(resultXml)
% >
the above javascript is here
< % end sub
% >
So again, visibly the browser shows the JSON, but the service that uses it doesn't get the RESPONSE it needs. Is there a way to write the JSON as response? I feel I am missing something and not quite understanding this.