Close Ajax page

What is the best way to close an open Ajax page.
smares323Asked:
Who is Participating?
 
Slick812Connect With a Mentor Commented:
greetings smares323, I looked at the code in the ajaxcode.txt , and that looks like some older code to a very simple AJAX Exchange, the question you have "close an open Ajax page", has noting to do with AJAX, and is just about using javascript.
this javascript -
document.getElementById("contentarea").innerHTML = "";

would get rid of the content that was loaded into that DIV by AJAX, however, there is no where on that page to place this javascript and have any correct functioning, or application to use that code.

here is a button that may work if you place it on the page-
<button onclick='document.getElementById("contentarea").innerHTML = "";'>Close Page</button>

not sure about what you are trying to do, but I see no reason to erase that DIV of content from AJAX, since there does not seem any way to do anything else in that code for that DIV to be used any other way.
0
 
Dave BaldwinFixer of ProblemsCommented:
What is an AJAX page?  AJAX is used to connect to the server on a page that is already open.
0
 
smares323Author Commented:
Ok close the Page generated by Ajax
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Dave BaldwinFixer of ProblemsCommented:
AJAX doesn't normally generate pages, it is used to modify the page that it is being used in.  I don't know what you're doing.
0
 
smares323Author Commented:
Ok if I opened a Page with Ajax a div id container after it opens what is the best way to close it
0
 
smares323Author Commented:
How do I close the div after I open it with ajax
ajaxcode.txt
0
 
smares323Author Commented:
Hello Dave Baldwin
0
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
In the example at http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm , they loading a div with external content.  Although they are saying 'page', it's not a complete page.  Basically, to get rid of the content, you load some other content even if it's just a blank space.  You could also just set the display to 'none'.
0
 
smares323Author Commented:
Great advice.
0
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.