Welcome Guest, Not a member yet? Register   Sign In
Using JQuery in CI for newbie
#1

[eluser]Unknown[/eluser]
hi everyone...

i have a simple question and i want someone here could teach me step by step...

i want to use jQuery in CI..

first : which folder in CI that jquery.js file should be..?
second : how i should write in controller..?

maybe some example could be the answers to all question above..

thanks for the explanation before...
#2

[eluser]Crimp[/eluser]
Just use jquery as you would on a site without CI. There is really no need to integrate it with CI controllers. Put your /scripts folder in webroot and write your javascript in the views.
#3

[eluser]Unknown[/eluser]
ok thanks for your answer...

i'll do it
#4

[eluser]George Ornbo[/eluser]
I'd second that. Keeping separation between the logic and behavioral layers is a good idea. Put JS in a separate file and then manipulate the DOM when it is ready. Building in this way makes it easier to make sure it all works without Javascript too.
#5

[eluser]BD-CI-Programmer[/eluser]
keep your jQuery file at your root directory and load it on your view page..
#6

[eluser]MadZad[/eluser]
A bit of a thread hijack, but what are some feature examples that folk use jQuery for? I carry some old prejudices against JavaScript (forgive me, but when I first delved into web programming, it usually was a bad idea), and my current projects don't have a lot of need for panache. So I'm just looking for reasons to justify the time it will take to spin up on jQuery (sadly, very little time for new stuff, so must be judicious).
Thanks.
#7

[eluser]Crimp[/eluser]
No point using something for the mere sake of it. Using jquery commonly for json/jsonp and ajax and effects like table sorting and striping, tabs and modal windows (lightboxes). But it really shines when you have to add some DOM manipulation because it makes sense from a user perspective and you write it in like 5 lines.
#8

[eluser]Jamie Rumbelow[/eluser]
Some good simple jQuery examples can be found at:

http://www.webdesignerwall.com/tutorials...designers/

I learnt a lot from them!
#9

[eluser]Michael Ekoka[/eluser]
I myself had some prejudice with JavaScript from back when I tried to learn the language (The definitive guide 3rd ed). When I found out that I needed to learn the Netscape and the IExplorer approach, I quickly gave it up and decided to concentrate on other programming languages instead. I was convinced that all my application would be relatively Javascript free.

About 3 years ago, the term Ajax was coined and Javascript frameworks made a big resurgence. The nice thing about them is that they abstract Javascript from most of the browser specific nonsense. It is therefore possible to give a high level of responsiveness to your application and add some usability to your interface without worrying too much about the browser engine. If your concern is accessibility, you can use techniques such as "progressive enhancement/graceful degradation" to keep your application accessible to non javascript users.

Amongst the frameworks, JQuery seems to be one of the favorites (if not the favorite) for its combination of light footprint and power. Like Crimp pointed out, its approach to manipulate the DOM is an example of ingenuity in itself.




Theme © iAndrew 2016 - Forum software by © MyBB