How to Response.Write some variable and nothing else should be sent to client except that variable
I have a global variable in my javascript, whose value I want to set again from the response I get from server after calling the server through $.post()
. I use the following code at the server s开发者_如何学编程ide and write the variable QS
to the Response Stream after clearing it. So, according to me nothing should be there in the Response except that variables's value.
The code:-
Response.Clear();
Response.Write(QS);
HttpContext.Current.ApplicationInstance.CompleteRequest();
But what is happening is, the variable's value is there in the Response in the beginning but then other things are appended to the Response. I just want the variable's value and nothing else.
When I have Called CompleteRequest()
, then from where these extra things are getting added to the Response ?
Please help..
Try to use the following code:
Response.Clear();
Response.Write(QS);
Response.End();
Does this work for you?
精彩评论