rendered paste body<script type="text/javascript"> function get(id) { return document.getElementById(id); } function ajax() { var xmlHttp; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { return false; } } } return xmlHttp; } ajax = ajax(); function checkUsername() { ajax.onreadystatechange = function() { if(ajax.readyState == 4) { get('ajax_output_node').innerHTML = ajax.responseText; } } ajax.open("POST","ajax/register_ajax.php",true); ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ajax.send('username=' + get('id_username').value); } </script>used in:<input onkeyup="checkUsername();" type="text" name="username" id="id_username" value="<?php if (isset($_POST['username'])) { echo $_POST['username']; }?>" />