Reputation: 10850
If I have a classic ASP response in the format:
someJsFunctionName({"0":{"field1":0,"field2":"","field3":0,"field4":2,"field5":1,"field6":1}});
that is built with
response.write "someFunctionName("
someMethod(param1, param2).Flush
response.write ");"
If I want to insert a new field to the response
someJsFunctionName({"0":{"field1":0,"field2":"","field3":0,"field4":2,"field5":1,"field6":1, "field7":2}});
Would I be able to call a method similar to
response.replace("}});", "\"field7\":2}});")
?
Or would I have to clear the entire response to write a new string into it?
Would I have to keep track of the result of someMethod(param1, param2).Flush
, modify that string before writing it to the response?
Upvotes: 3
Views: 547
Reputation: 16672
I can't see any need for you to output directly to the Response
buffer, to be clear you can only manipulate the Response
buffer up to the point you Call Response.Flush()
as this clears the buffer and writes the headers. Up to that point you can still Call Response.Clear()
to empty the buffer without writing it then fill the buffer again with Call Response.Write("yourstring")
.
The reason I can't see a need for this is because you could get the same effect by simply assigning your string to a variable building it up (manipulating it with Replace()
if you want to) then Call Response.Write(yourstringvariable)
to output it.
Dim myfunc
myfunc = "someFunctionName("
'someMethod should return a string
myfunc = myfunc & someMethod(param1, param2)
myfunc = myfunc & ");"
Call Response.Write(myfunc)
Upvotes: 3