How to clear page content?

Posted on 2007-10-06
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

    make myString a public variable
    and on your aspx page simply do a <%= myString %> where you want the text to go

    Author Comment

    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

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    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…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now