How to clear page content?

I'm doing an AJAX request and get the response from XMLHttpRequest.responseText.  The code behind (ASP.NET 2.0) does a Response.Write(mystring).  In JavaScript, I then parse out mystring, since all of the other aspx page's HTML content is still there.  mystring is at the top of the response, followed by the page's HTML layout content.  To avoid parsing, how can I send back the response (mystring) only without the HTML page content?
Who is Participating?
make myString a public variable
and on your aspx page simply do a <%= myString %> where you want the text to go
brettrAuthor Commented:
The JavaScript that does the async call is in a JS file, which means it isn't in the FORM tag, which means <%...%> can't be used.

The asynch call request the same aspx page it is linked into.  That's why I want to return on the requested content.  But since I'm calling the same page, I get all of the HTML layout mixed in as well.  Then again, maybe I don't understand what you mean.

I do have a server side HTML DIV tag that has its innerHTML loaded from the code behind on initial page load.  I get content from it using the JS.  On the async call, I can assign the requested content to this DIV.  The problem is that it won't refresh client side since that part of the page isn't getting a partial update.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.