Welcome Guest, Not a member yet? Register   Sign In
AJAX for CodeIgniter sample code
#1

[eluser]medium_kreation[/eluser]
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.
#2

[eluser]xwero[/eluser]
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.
#3

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

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

You would do something like:

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

Instead of echo'ing the return use:

Code:
$this->output->set_output($content);

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
#4

[eluser]xwero[/eluser]
I like to think the x in ajax stands for whatever format instead of xml Smile
#5

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

thanks
for your replies




Theme © iAndrew 2016 - Forum software by © MyBB