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!
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);
精彩评论