Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to clear page content?

Posted on 2007-10-06
Medium Priority
Last Modified: 2012-08-13
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?
Question by:brettr
LVL 12

Accepted Solution

ullfindsmit earned 2000 total points
ID: 20029211
make myString a public variable
and on your aspx page simply do a <%= myString %> where you want the text to go

Author Comment

ID: 20029228
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.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question