clear div 5 seconds after ajax returns value

Posted on 2010-08-26
Last Modified: 2013-12-13
I am trying to figure out how I can make a div clear all of its information about 5 seconds after it appears..I am running an ajax script and I just want the information it returns to appear for a few seconds then dissapear.
Question by:brad0525
  • 2
LVL 82

Accepted Solution

leakim971 earned 500 total points
ID: 33535961
in your callback function (where you get the answer of your call) use setTimeout :

setTimeout("document.getElementById('mydiv').innerHTML = ''",5000);

Expert Comment

ID: 33539052
Use the time out function after the Ajax call...

Author Closing Comment

ID: 33626758
Thank for the example
LVL 82

Expert Comment

ID: 33626794
You're welcome! Thanks for the points!

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

930 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

11 Experts available now in Live!

Get 1:1 Help Now