Codeigniter Tutorial: How To check Username/Email availablity using jQuery in Codeigniter?

Author: Zeeshan Rasool  |  Jul 4, 2010 AJAX, Codeigniter, PHP, Web Development

This post is for CI lover who wants to learn Codeigniter. This script will show you how can we check live availability of username or email using Ajax in Codeigniter. Using this tutorial you can also understand how can we send a jQuery Ajax request to server living in CI.

[ad#ad-4]
In your view where you have created form include jQuery library and put the below code there.
In header section:

In body section in your form:

[ad#co-2]
In Your controller add this function:

Suppose you have a model called my_model.php and a table tbl_members or what ever you named. This table should have a field named “email” of type varchar [200].
Add this function:

Thats it, this function will return a message against email field that whether it is available or not. This is not for only email, you can use it to check any field. Also this is client side check so you also need to use this model function in server side so that email can also be verified when form has been submitted with disabling javascript .


Zeeshan Rasool is the founder and editor of this blog. Beside this, he is an experienced PHP web developer and freelancer. He loves to create best and interactive web apps. You can follow him at twitter @99_Points and facebook OR drop an email at 99points.info@gmail.com


Email Subscriber!

Be the first to know about new updates


Advertisement


Categories


Popular post