![]() |
Request check user availability CodeIgniter jquery example code - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Request check user availability CodeIgniter jquery example code (/showthread.php?tid=23794) |
Request check user availability CodeIgniter jquery example code - El Forum - 10-21-2009 [eluser]jiahui[/eluser] I am very new in codeIgniter. I have read quite many articles about codeIgniter jquery in these 2 weeks but nothing help to solve my problem. Any kindness expert who willing to help me work it out? This is my working coding: I write following coding in my view/index.php Code: User Name : <input name="username" type="text" id="username" value="" maxlength="15" /> in my controller I did include: Code: class Accounts extends MY_Controller { In blur.js: Code: $(document).ready(function() Request check user availability CodeIgniter jquery example code - El Forum - 10-21-2009 [eluser]Mackstar[/eluser] Please tell us what you are wanting to do, before we have to go through your code to work it out... Cheers Richard Request check user availability CodeIgniter jquery example code - El Forum - 10-22-2009 [eluser]jiahui[/eluser] Thanks for you fast reply. I'd like use jquery method to pass $username (in blur.js) to user_check_availability.php page to process whether is the username available to use or not. Request check user availability CodeIgniter jquery example code - El Forum - 10-22-2009 [eluser]Mackstar[/eluser] I would check your controller method "check_user_availability" first and checking that this is correct, use GET to do this. once you are confident this works then it will be JQuery you need to look at. You can check the incoming ajax request using Firefox - firebug or HttpFox plugin, if the returning data is correct, then you can look into your post call $.post("/accounts/check_user_availability",{ user_name:$(this).val() } ,function(data) if this is OK then check your fading in function Just check each step until you can find out what part of the process is not working. Hope it helps Cheers Richard Request check user availability CodeIgniter jquery example code - El Forum - 10-22-2009 [eluser]jiahui[/eluser] I had downloaded firebug to test but nothing work to me. Again alert every line of my script also get nothing error there. try use Get instead of Post. but it nothing help to me... I'm getting crazy. What I did wrong?? Richard would you be kind to provide an example to check user_availability coding by using this codeigniter framework? You kindness will be much appreciated....... Request check user availability CodeIgniter jquery example code - El Forum - 10-22-2009 [eluser]jiahui[/eluser] I had downloaded firebug to test but nothing work to me. Again alert every line of my script also get nothing error there. try use Get instead of Post. but it nothing help to me... I tried to echo username which in check_user_availability.php, but it nothing happen there. Cannot echo out but also no errors there... I'm getting crazy. What I did wrong?? Richard would you be kind to provide an example to check user_availability coding by using this codeigniter framework? Your kindness will be much appreciated.......[/quote] Request check user availability CodeIgniter jquery example code - El Forum - 10-22-2009 [eluser]Mackstar[/eluser] Hi I managed to get it working, the JS is as follows Code: $(document).ready(function() { Also note that you had user_name being posted but the CI controller looking for username. So I have changed it in the js, which should now work. FYI I have my other files as accounts.php Code: <?php and views/index.php as Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Cheers Richard Request check user availability CodeIgniter jquery example code - El Forum - 10-22-2009 [eluser]jiahui[/eluser] Bravo!! It's work perfectly. I love you Richard!! ;-P Request check user availability CodeIgniter jquery example code - El Forum - 10-23-2009 [eluser]jiahui[/eluser] halo, Richard. I got question again. Hope you can help me too. This time I'd like to connect database (controller) to check the availability status. In order to do that I changed my code as the following: Code: $this->db->where('username', $username); It doesn't work... But if I write the coding in this way, it can be worked. Could you tell me what's the problem it is? Code: $SQL="select * from user where username='".$username."'"; |