Solved

Close Ajax page

Posted on 2014-04-17
9
305 Views
Last Modified: 2014-04-25
What is the best way to close an open Ajax page.
0
Comment
Question by:smares323
  • 5
  • 3
9 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
What is an AJAX page?  AJAX is used to connect to the server on a page that is already open.
0
 

Author Comment

by:smares323
Comment Utility
Ok close the Page generated by Ajax
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
 

Author Comment

by:smares323
Comment Utility
Ok if I opened a Page with Ajax a div id container after it opens what is the best way to close it
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:smares323
Comment Utility
How do I close the div after I open it with ajax
ajaxcode.txt
0
 

Author Comment

by:smares323
Comment Utility
Hello Dave Baldwin
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
Comment Utility
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
 
LVL 33

Accepted Solution

by:
Slick812 earned 250 total points
Comment Utility
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
 

Author Closing Comment

by:smares323
Comment Utility
Great advice.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

762 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

10 Experts available now in Live!

Get 1:1 Help Now