chrischen Posted February 21, 2008 Share Posted February 21, 2008 I have ajax load an external page into a div. How do I unload that to return the page to the normal state like it is if the person refreshes it? Link to comment https://forums.phpfreaks.com/topic/92239-unload-ajax/ Share on other sites More sharing options...
phpQv3.0 Posted February 21, 2008 Share Posted February 21, 2008 You could do something like this: <script language="javascript"> var content = "yourDIVsIDHere"; // replace this with your div's id; the div that contains your external page, that was loaded by ajax function resetDIV() { document.getElementById(content).innerHTML; } </script> <div id="yourDIVsIDHere"> <!-- external page would have been displayed here --> </div> <br><br> <input type="button" onclick="resetDIV()" value="Clear It!"> Link to comment https://forums.phpfreaks.com/topic/92239-unload-ajax/#findComment-473204 Share on other sites More sharing options...
The Little Guy Posted February 22, 2008 Share Posted February 22, 2008 or... instead of replacing the old text you could just use a style to hide it. and display the new, then vise versa to go back. so... /* Some ajax stuff above */ if(ajaxRequest.readyState == 4){ document.getElementById('newPageStuff').style.display = "block"; document.getElementById('oldPageStuff').style.display = "none"; } /* Some ajax stuff below */ Link to comment https://forums.phpfreaks.com/topic/92239-unload-ajax/#findComment-473403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.