• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AJAX for CodeIgniter sample code

I am new to code Igniter and have very little knowledge of Ajax..
I am trying to find help on "AJAX for CodeIgniter" library.. a real example of how to implement an auto_complet suggestion..
but am unable to locate any help on "AJAX for CodeIgniter"..
found many ref. links on xajax,mootools, but faild to find any live example explained to accomplish the auto_complet with ajax through "AJAX for CodeIgniter".

pleas can any one explain how to use it.. even the user cuide that comes with "AJAX for CodeIgniter" is not helping out.

plz help.

The usage of ajax depends on which library or custom implementation you want/need to use on your website so there can be no such thing like a general ajax tutorial for CI.

The CI/php/other server language code for ajax produces nothing more than a generated output in form of xml,html,json or just plain text. So that is what you have to do using CI.

I'm a jquery user myself so for auto completion i would get a plugin for it (thank you jquery community), see how the output needs to be and output the desired format.

[eluser]Phil Sturgeon[/eluser]
Its pretty damn basic if you already know AJAX. Instead of something like:

$.getJSON("ajax.php",{country: $(this).val(), ajax: 'true'}

You would do something like:

$.getJSON("<?=site_url('controller/ajax_method');?>",{country: $(this).val(), ajax: 'true'}

Instead of echo'ing the return use:


Of course the JavaScript depends on the lib you are using but if you are trying AJAX in CI I have to assume knowledge of JS on your part.

While this method is technically AJAJ.... its all the same junk really :p

I like to think the x in ajax stands for whatever format instead of xml Smile

thank, with a little effort i got it working.
after reading http://wiki.script.aculo.us/scriptaculou...ocompleter
i got it working

for your replies

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.