Welcome Guest, Not a member yet? Register   Sign In
Configuring CodeIgniter for jquery
#1

[eluser]tim042829[/eluser]
I've googled a number of tutorials that illustrate using jquery with CodeIgniter,
however, I do not see any of them illustrating how to configure CodeIgniter to use
jquery.
Example:
On my workstation, I have a CodeIgniter tutorial branch at
http://localhost/CodeIgniter
and
jquery is at:
http://localhost/js/jq/jquery.js
I presume that /system/application/config/config.php needs some sort of
$config assignment to 'tell' CI what path to emit into the rendered content.
So if you look at http://demos.blufusion.net/ajax-post,
you will see the following path
Code:
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
inside of a script tag.
I would expect the value of that URL to be assigned to some configuration expression key.
Please advise
thanks
tim
#2

[eluser]n0xie[/eluser]
Quote:I presume that /system/application/config/config.php needs some sort of
You presume wrong. You don't need any configuration since CI runs server side and jQuery runs client side. The only thing you need to do for ajax calls is call a controller/method. In your controller you return some data, most likely in JSON. That is all.
#3

[eluser]Unknown[/eluser]
You can use script tag as always in your file inside View folder, for example:
Code:
<html>
<head>
<#script type="text/javascript" src="&lt;?=base_url(); ?&gt;js/jq/jquery.js"><#/script]
<#script type="text/javascript">
$(function(){
     // your javascript code goes here..
});
<#/script>
&lt;head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
#4

[eluser]tim042829[/eluser]
Thanks thaqien.
I also found this:
http://net.tutsplus.com/tutorials/php/ho...nd-jquery/
cheers
tim
#5

[eluser]tim042829[/eluser]
[quote author="n0xie" date="1281018008"]
Quote:I presume that /system/application/config/config.php needs some sort of
You presume wrong. You don't need any configuration since CI runs server side and jQuery runs client side. The only thing you need to do for ajax calls is call a controller/method. In your controller you return some data, most likely in JSON. That is all.[/quote]
My presumption was that there was a tight integration between jQuery and CodeIgniter.
My apologies.
thanks
#6

[eluser]pickupman[/eluser]
Quote:My presumption was that there was a tight integration between jQuery and CodeIgniter.
My apologies.
thanks
They are both kick a** frameworks though.
#7

[eluser]tim042829[/eluser]
Right on pickupman.
And great signature, BTW.
#8

[eluser]Yorick Peterse[/eluser]
[quote author="tim042829" date="1281040358"][quote author="n0xie" date="1281018008"]
Quote:I presume that /system/application/config/config.php needs some sort of
You presume wrong. You don't need any configuration since CI runs server side and jQuery runs client side. The only thing you need to do for ajax calls is call a controller/method. In your controller you return some data, most likely in JSON. That is all.[/quote]
My presumption was that there was a tight integration between jQuery and CodeIgniter.
My apologies.
thanks[/quote]

Codeigniter v2 will have intergration with jQuery so you're not entirely wrong.
#9

[eluser]Crni[/eluser]
Quote:Codeigniter v2 will have intergration with jQuery so you're not entirely wrong.

Have this option now?

Some examples for using it?




Theme © iAndrew 2016 - Forum software by © MyBB