![]() |
Simple ajax functionality in CI - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Simple ajax functionality in CI (/showthread.php?tid=44179) Pages:
1
2
|
Simple ajax functionality in CI - El Forum - 08-06-2011 [eluser]Dileep[/eluser] Hai , I want to know that how can i integrate Ajax functionality on CI_. see the code below , A controller named New : ************************* Code: Class New extends CI_Controller ************************** Code: <html> I just want to get the $name in cname textbox when we click on cbutton button,with out page load,how can i achieve this by using ajax or Javascript ? I knw it is a Newbie Q,but please help me $ also i am welcome some links to CI-AJAX tutorials for beginners. Thanks. Simple ajax functionality in CI - El Forum - 08-06-2011 [eluser]Unknown[/eluser] Hi bro... Check out this :coolsmirk: http://littlebrain.org/2008/05/27/codeigniter-and-ajax-using-jquery-tutorial/ Simple ajax functionality in CI - El Forum - 08-06-2011 [eluser]Rok Biderman[/eluser] Well, if all you want to do is fetch a name, you don't need ajax, just do this Code: <input name="cname" type="text" value="<?php echo $name;?>" /> Code: $(document).ready(function() { and for controller: Code: public function ajaxrequest() you could simplify this quite a bit if you used id in addition to name tag in your inputs. It's also a bit faster, cause the selector engine does less work. Simple ajax functionality in CI - El Forum - 08-07-2011 [eluser]Dileep[/eluser] Ohh thank you ,but could you please explain little bit more ? Simple ajax functionality in CI - El Forum - 08-08-2011 [eluser]Rok Biderman[/eluser] I think we're going to go pretty far from this forums' topic, but sure, why not. What do you want me to explain further? Simple ajax functionality in CI - El Forum - 08-09-2011 [eluser]Dileep[/eluser] Could you please fulfill the code with full syntax,so that i can learn from that,because i need a working sample. I got the idea,but i cant execute. Thanks for helping,its very inspirational for newbies. Simple ajax functionality in CI - El Forum - 08-09-2011 [eluser]Rok Biderman[/eluser] Just to avoid repeating myself, I'll introduce some other elements, that can come in handy, when dealing with ajax requests. It's all commented, so you shouldn't have problems. This is a welcome controller: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); and this is view myview.php Code: <!DOCTYPE html> I would suggest you start using firebug's net tab to see the requests you're sending, without it you're more or less running blind. If it confounds you further, find additional help in jquery manuals and tuts, but this is really all there is to it when integrating it into Codeigniter. Simple ajax functionality in CI - El Forum - 08-10-2011 [eluser]Dileep[/eluser] Thanks for your nice reply,it helped me to understand something about Jquery,but unfortunately its not working with me,there is no change in the view,let me try Firebug. Simple ajax functionality in CI - El Forum - 08-10-2011 [eluser]Rok Biderman[/eluser] I'm attaching the files, see if we can make it clearer. If these don't work, it would either have to be server config or browser issues. Simple ajax functionality in CI - El Forum - 08-10-2011 [eluser]jblack199[/eluser] on the wiki tutorials, there is a GREAT tutorial about using jquery for ajax functionality. It is day 8 tutorial I believe, helped me understand how to implement jquery for use with my forms.. |