开发者

How to Response.Write some variable and nothing else should be sent to client except that variable

开发者 https://www.devze.com 2023-03-19 22:41 出处:网络
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开发者

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消