1

I want to make a delay when the result comes in the note.

I have a form > input the user types his username in the input and I check with AJAX

if the username is available or not. If yes a note shows up near the input with the

result.

Please no jQuery!

3
  • I don't see what the question title has to do with the question body? Commented Jul 4, 2010 at 14:34
  • Why would you want the feedback to be delayed? Commented Jul 4, 2010 at 14:43
  • the script starts to run from the first word, so I don't want to show useless results... and looks better, and feels better :) Commented Jul 4, 2010 at 14:47

1 Answer 1

2

You may want to use setTimeout() to display something after a short delay:

var delay = 1000;            // 1 second
var result = 'note here';    // the result from your AJAX response

setTimeout(function() { 
   document.getElementById('note').innerHTML = result; 
}, delay);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.