Jump to content
xisto Community
khalilov

Checking Without Loading

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.