![]() |
CODEIGNITER ROOKIE - 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: CODEIGNITER ROOKIE (/showthread.php?tid=20887) |
CODEIGNITER ROOKIE - El Forum - 07-24-2009 [eluser]djjonex[/eluser] Hello everyone, I'm trying to make a register form and I would like to check if the username is available... I know thats AJAX... I know that I can create a button that calls a javascript function.... the script read the input, send to the PHP code(db query), and receive the answer to display in a <div>.... The thing I don't know is how to do it in CodeIgniter .... If somebody wants to help me with the sintax or give me some examples ... I'll appreciate... Thank! CODEIGNITER ROOKIE - El Forum - 07-24-2009 [eluser]Cro_Crx[/eluser] Before you create a checker in AJAX, it's probably best to try one in just plain PHP and then once you get that concept then create an AJAX one. You'll need to create a callback function for your form validation class. Here's the link http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#callbacks Let me know if your still stuck, I can post some code snippets if you'd like. CODEIGNITER ROOKIE - El Forum - 07-24-2009 [eluser]djjonex[/eluser] Yeah Lab Assistan, thanks for tying to help me. I understand that validation class. So ... what's next? CODEIGNITER ROOKIE - El Forum - 07-24-2009 [eluser]xzela[/eluser] [quote author="Cro_Crx" date="1248474684"] You'll need to create a callback function for your form validation class. Here's the link http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#callbacks [/quote] I think the form validation uses a form submit. Plus, the callback is only ran once a form has been submitted, which really isn't ajax. You may want to read up on jQuery or script.aculo.us. They have some examples you can try in normal PHP. But Cro_Crx is right, you'll need to get the idea down before implementing it in CodeIgniter CODEIGNITER ROOKIE - El Forum - 07-24-2009 [eluser]djjonex[/eluser] Ok I understand a litle bit of JQUERY.... but where exactly in the host I have to place the .js ...... using code igniter CODEIGNITER ROOKIE - El Forum - 07-25-2009 [eluser]Tyler Diaz[/eluser] I recommend following this tutorial for the jQuery : http://jqueryfordesigners.com/using-ajax-to-validate-forms/ If you get too stumped on how to use your JS file or so, post back. |