CodeIgniter Forums
How to use jQuery with Code Igniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How to use jQuery with Code Igniter (/showthread.php?tid=24278)



How to use jQuery with Code Igniter - El Forum - 11-05-2009

[eluser]Anes P.A[/eluser]
Hello Pal,
I am Anes , a Newbie in code Igniter(CI). I like to know how jquery can use in code igniter(CI). I like to study same , do you can give some
Code snippet that I can work in my PC . I need to study How CI can use
jquery. Pls reply me with any good code snippet that is enough to give idea(Any working Stuff)...

With Great thanks
Anes P.A


How to use jQuery with Code Igniter - El Forum - 11-05-2009

[eluser]jhayghost[/eluser]
Hello,

I am using jquery and you only need to place the jquery to your public folder then if your using template embed the jquery to your template ex.
Code:
script type="text/javascript" src="<?=site_url('/public/js/jquery.js')?>"
same with your other js. to us the ajax method of jquery
Code:
$.ajax({
   type: "POST",
   url: "/model/function",
   data: "var1/John/var2/Boston",
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
});



How to use jQuery with Code Igniter - El Forum - 11-05-2009

[eluser]tomcode[/eluser]
[quote author="jhayghost" date="1257428611"]Hello,

Code:
script type="text/javascript" src="<?=site_url('/public/js/jquery.js')?>"
[/quote]

Use base_url() instead of site_url() for addressing CI external files, see the User Guide


How to use jQuery with Code Igniter - El Forum - 11-05-2009

[eluser]BrianDHall[/eluser]
Other than how CI handles url segments and by default does not use GET queries, jQuery works with CI just like it works with anything else in PHP, no difference.

You can easily go to the jQuery site and learn jQuery and should be able to apply what you know to CI with little or no adjustments.

Same thing with learning CI. CI and jQuery together isn't much different than using them alone.


How to use jQuery with Code Igniter - El Forum - 11-06-2009

[eluser]jedd[/eluser]
I found this little page of links to CI / jQuery tutorials a little while ago.

[url="http://choosedaily.com/1052/9-ways-to-integrate-ajax-with-codeigniter/"]http://choosedaily.com/1052/9-ways-to-integrate-ajax-with-codeigniter/[/url]


How to use jQuery with Code Igniter - El Forum - 11-06-2009

[eluser]Ben Edmunds[/eluser]
Hey Anes,

I replied to your email.

Make sure the url helper is loaded.