HOME       >>       Programming

Checking Without Loading


i like how some sites check the username you inputed and tells you if its not available without loading. Like hotmail when trying to make an email. How do you do that?


You need to use ajax to get the job done. Most website nowadays incorporate some form of ajax using javascript. Look up on ajax or XMLHttpRequest in google. That should get you enough sample code to get started. To accomplish the end result, assuming you're using php, you need to send the already inputed username to a specific php page you've made via GET or POST method. GET is easier to do with ajax. In that php page, you just need to look up the username in your existing database and return a token to indicate if it's already existed. You can simply return a 1 or 0 using echo. You don't have to echo any html since you're will reading directly from your html's javascript. The lesser the data you pass around the better response you can get.


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.