How to use jQuery with Code Igniter

#1
[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

#2
[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 );
   }
});

#3
[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

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

#5
[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]

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

I replied to your email.

Make sure the url helper is loaded.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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