使用javascript / ajax设置延迟

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);