multisite registration: check existing subdomains while typing

Searching on google I found this jquery script that, maybe, could be a starting point.
But to tell the true, I don’t know exactly how to connect this to the wp-signup.php file.

If I’m not in worng. The jquery function is executed on ‘keyup’ and check the data returned from the “scripts/db_check_url”.
What I’m missing is this “scripts/db_check_url” that will perform the database search.

Any suggestions?
Thank you very much.

// css styles
//
<style>
.error {background-image:url('error.jpg');}
.success {background-image:url('success.jpg');}
</style>


//input textfield with an icon check
//
<input class="subdomain" type="text" value="" name="url">
<div id="icon-message" class="error"></div>

//jquery function
//
(function($){
    $(document).ready(function(){
        $('input[name="url"]').on('keyup',function(){
         var val=$(this).val();
         $.post(scripts/db_check_url',{url:val},function(data){
            if(!data.error){
              $('#icon-message').removeClass('error').addClass('success');
            }else{
              $('#icon-message').removeClass('success').addClass('error');
             }
         },'json');});
    $('input[name="url"]').trigger('keyup');});
})(window.jQuery);