Part of the EllisLab Network
   
1 of 3
1
Poll
Do you agree that we need an official AJAX library ?
Yes! please 135
NO! dont waste your time, CI team!! 21
being a noob doesn’t mean we should make a whole library for you! 7
Total Votes: 163
You must be a logged-in member to vote
We need official AJAX library from CI team !
Posted: 13 December 2008 07:04 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  12-04-2008

Hello everyone,

Please… let me tell you my little Sad story confused

I’m working on my first project using CI,

first i had to make a WHOLE Users system, but Thx to DX Auth
did the job and even gave me more functions that i wouldn’t have dreamed of ^^

Then…. i needed to use ajax. :(
first, i searched all over the wiki, and found few libs. but i picked (AJAX for CodeIgniter)

i didn’t like the way it works actually ( to make a link, u’ll have to use a function, to use a button u have to use Another function , and so on )

and also there’s no need to use a WHOLE js framework just to call files through Ajax ... dont u think?

i know this library does more than just ajax files calling, this is the point. we need Ajax library, not a JS library

on top of all of this, the prototype lib, conflicted with the jquery lib (i used it for another purpose),

and when i solved the problem, guess what ? there was a problem with the prototype lib. it self,
so i said, (*beep* it) .. i worked on this thing for almost 7 hours and… 
progress : 0, ZERO, NONE

then a brilliant idea came to my mind, why dont i use just the normal way to ajax things (add JS code to haeder, use ajax() function , code attached)!!! guess what again ? it WORKED snake


after a real hard day, i came up with few tips :
1- never give up with a code, because there’s always a solution ( doesn’t mean that u can forget your Deadlines
2- always save your own old codes, could help u someday
3- help ppl by showing the problems you had, maybe someone will help you, or maybe you’ll help someone by showing him that, THERE’S NO SOLUTION FOR THIS ONE,!! lol


and the Most important thing,
We need an Official AJAX library from Codeigniter Team,

no that i think that no one can make a good lib. but only that im Pretty sure, many many people will get through all of this problems over and over, until we get the official library


so what do u think ?


* P.S: i know that many of you guys thinking ( lazzy ass, go make your own library, stop crying about it )
Well, THANK YOU tongue laugh But you cant say we dont need it ,


Kind Regards.
Mossab

File Attachments
ajax_code_Codeigniter.zip  (File Size: 1KB - Downloads: 369)
 Signature 
Profile
 
 
Posted: 13 December 2008 10:09 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
RankRank
Total Posts:  120
Joined  11-02-2008

Stop crying about it.

joke ;p

Profile
 
 
Posted: 13 December 2008 10:49 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  12-04-2008

hahaha so funny

 Signature 
Profile
 
 
Posted: 14 December 2008 12:33 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
RankRankRankRank
Total Posts:  1040
Joined  06-19-2007

Mossab,

May I make a kind observation about a few of your comments?  OK, I will anyway wink

First, you say…

i didn’t like the way it works actually…

about one method to implement what you desire with CI. How likely is it that someone would produce the perfect solution according to standards that you do like?  In any event, please go back to the wiki and put ‘ajax’ in the search box at the top of the page.  The results returned should be about two full pages of various solutions.  You are bound to ‘like’ one of them.

Second,  this next statement is baffling…

i know this library does more than just ajax files calling, this is the point. we need Ajax library, not a JS library

Can you help clarify what you mean by explaining what you believe the differences are between and ‘Ajax library’ and a ‘JS library’ as you’ve stated things here?  Perhaps a short description in the differences in what you perceive the functionality to be between them?

Third, what if…

on top of all of this, the prototype lib, conflicted with the jquery lib (i used it for another purpose)...

and the CodeIgniter team had built the AJAX functionality a third approach that conflicted with both Prototype and jQuery?  You would have your wish…the CI team would have built an AJAX library for CI.  But would you have been happy with them or their work?  Or would you blame them for creating an interoperability problem within your application?

========

This is a very complicated issue.  The good news is that jQuery is going to be included with CI sometime in the future.  That is good news because we’ll be able to see some consistency within the CI framework when it comes to things like the use of AJAX.  I don’t think the team plans on building an “AJAX library”, but I’m often wrong about many things,

Best regards,

Randy

 Signature 

My new therapist is working with me every day, the third one gave up… ohh

Profile
 
 
Posted: 14 December 2008 10:53 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  12-04-2008
Randy Casburn - 14 December 2008 05:33 AM

Mossab,

May I make a kind observation about a few of your comments?  OK, I will anyway wink

First, you say…

i didn’t like the way it works actually…

about one method to implement what you desire with CI. How likely is it that someone would produce the perfect solution according to standards that you do like?  In any event, please go back to the wiki and put ‘ajax’ in the search box at the top of the page.  The results returned should be about two full pages of various solutions.  You are bound to ‘like’ one of them.
Well, i thought i made my self clear about this when i didn’t say any functions i would like to see in the lib. it’s not up to me to say exactly what functions it must have
all what i asked for is an official lib. from CI smile because i Belive and i know that they will make the exact idea we’re all thinking of ( not just me )
and i even looked on the other libs. (few of them) and i guess it wasn’t as simple as i thought it will be ( not what we got used on while using CI official libs. )

Second,  this next statement is baffling…

i know this library does more than just ajax files calling, this is the point. we need Ajax library, not a JS library

Can you help clarify what you mean by explaining what you believe the differences are between and ‘Ajax library’ and a ‘JS library’ as you’ve stated things here?  Perhaps a short description in the differences in what you perceive the functionality to be between them?
as we all know, what AJAX really does, is calling files using the XMLHttpRequest object,
so, why would i download a lib. that has many many things that i dont really need ? ( talking about AJAX_for_CodeIgniter library) , as you can see there’s too many functions that has nothing to do with AJAX(in my opinion) ,
such as (alert, assign, call, hide, redirect_to, remove, show, dragable_element, drop_receiving_element, sortable_element, visual_effect, in_place_editor etc.)

do you think all of these functions are really really Really important to call a file through AJAX ? then i guess take some of your time and read what is the AJAX

Third, what if…

on top of all of this, the prototype lib, conflicted with the jquery lib (i used it for another purpose)...

and the CodeIgniter team had built the AJAX functionality a third approach that conflicted with both Prototype and jQuery?  You would have your wish…the CI team would have built an AJAX library for CI.  But would you have been happy with them or their work?  Or would you blame them for creating an interoperability problem within your application?
hmmm you wanna bet ? take a look at the code i attached in my first post, and see how Simple it is , and even go make your own tests and see if it conflicts with the other libs. even if it does, im sure with this few lines, you can fix it, but you CANT fix a whole library because you want to use only a PART of it, can you ? ( not talking about you as a person btw, )

========

This is a very complicated issue.  The good news is that jQuery is going to be included with CI sometime in the future.  That is good news because we’ll be able to see some consistency within the CI framework when it comes to things like the use of AJAX.  I don’t think the team plans on building an “AJAX library”, but I’m often wrong about many things,
never said i dont need a jQuery library or anyother library included with CI, im sure it will be even easier than usual, but we’re talking about AJAX here, not JS libraries (Big difference)

 

P.S: i REALLY dont have anything against AJAX_for_codeigniter library, it’s just happened accidentally that i used it,


Kind Regards.
Mossab

 Signature 
Profile
 
 
Posted: 14 December 2008 11:20 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
RankRankRankRank
Total Posts:  1040
Joined  06-19-2007

Ok…thanks for your reply.

 Signature 

My new therapist is working with me every day, the third one gave up… ohh

Profile
 
 
Posted: 14 December 2008 12:49 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  12
Joined  09-22-2008

Hi,

Just to mention that I would be very happy to see jQuery officially included to CI.

I don’t think I will need something more than the consistency as Randy mentioned.

Perhaps an upgrade of the official forms helper lib in order to display validation warnings with visual enhancements such as fading effects for example(with the power of jQuery).

Profile
 
 
Posted: 14 December 2008 02:11 PM   [ Ignore ]   [ # 7 ]  
Lab Technician
RankRankRankRank
Total Posts:  1040
Joined  06-19-2007

@Artemis - I agree.

A broad stroke that satisfies many appetites (jQuery) surely would be better than a non-cross browser, simplistic script as proposed above.  Even if some view jQuery as having too much functionality. 

Perhaps all that cross-browser support and other not-no-obvious goodness that is provided by these ‘JS libraries’ isn’t understood by everyone. wink

Randy

 Signature 

My new therapist is working with me every day, the third one gave up… ohh

Profile
 
 
Posted: 14 December 2008 03:05 PM   [ Ignore ]   [ # 8 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  12-04-2008

@Randy - hahaha that was funny, maybe you didn’t get my idea, no problem

but really, tell me. you want to load the whole jQuery library only to use ajax function ? well, good luck with that Mr.pro :p

P.S : the attached code above is just a sample, just to show you how simple it is smile in case you think it’s too hard to make it work on most browsers, i guess thats your own problem ..

 Signature 
Profile
 
 
Posted: 14 December 2008 03:42 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  378
Joined  09-11-2006

The big issue I see with including a javascript library as part of CodeIgniter is that javascript is fundamentally a client-side language while PHP is a server-side language. I’ll be interested to see how the guys at EllisLab manage to reconcile the two environments.

That said, it is possible to make Ajax easier: at the moment it requires a fair amount of legwork to come up with a maintainable solution, and even then you’re stuck with a lot of functions prefixed with ajax_, which can offend some aesthetic sensibilities (mine own included).

I took a stab at making handling server-side Ajax easier by developing a JSON-RPC library that behaves similarly to the core CI XML-RPC library. It allows you to send all your Ajax requests to a single method and recieve differing responses according to the JSON-RPC 1.1 Working Draft.

 Signature 

August 2011: I’m not an active codeigniter developer right now. Feel free to contact me, but I may not be able to solve your problem for you.

flickr | twitter | rockets

Profile
 
 
Posted: 14 December 2008 04:06 PM   [ Ignore ]   [ # 10 ]  
Lab Technician
RankRankRankRank
Total Posts:  1040
Joined  06-19-2007

@Nick,  Yes I too handle my complex AJAX based applications on the server side with dedicated controllers/libraries to deal with the security issues that manifest themselves in regard to AJAX vulnerabilities. 

As far as the client side, I’m also curious to see where they go with the dumping of the JS library into the framework.  I’m not sure they will actually implement any JS as part of the core, but we’ll have to wait and see.  I’m currently actively developing with ExtJS and the Dojo Toolkit.  I’m worried about the meaning of jQuery in m favorite framework because of this, but I’ll get over it.

@Mossab - It is not my intent to offend you. I realize that you believe the least-common-denominator, fewest-lines-of-code, smallest-sized-JavaScript-file solution to your problem is the best answer.  I’m willing to accept that is your opinion.  What I’m asking you to do right now is accept my opinion too.  Here it is as the bottom line:

It is better to have the jQuery development team work on the client-side (browser) interoperability capabilities and issues related to all the client-side AJAX problems than it is to burden the CodeIgniter development team with a non-PHP development issue.  The result of that means that, yes, we all will have to load up the jQuery.js file to run the jQuery implementation of the XMLHttpRequest() method.

You don’t have to agree.

Randy

 Signature 

My new therapist is working with me every day, the third one gave up… ohh

Profile
 
 
Posted: 14 December 2008 04:12 PM   [ Ignore ]   [ # 11 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  12-04-2008

@Randy
Well, as you said, i dont have to agree, but even with that, doesn’t mean you are wrong smile

 Signature 
Profile
 
 
Posted: 14 December 2008 04:55 PM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  496
Joined  07-16-2008

CI should NOT tie it’s self to any JS libary! Sometimes I need jQuery and sometimes I need Mootools…

Also, why would a bunch of talented PHP programmers try to create their own from scratch? That is just a waste of time - let the JS programmers keep building their libraries (which there are way to many of already) and the CI Team can keep making CI great!

Also, if you just want a small library for ONLY AJAX just use Mootools - it plugs in great and you can build your own version of it if you don’t like the huge 63kb filesize. Use the mootools CORE builder to only download the AJAX part. http://mootools.net/core

Take a look at my site if you want an example.

 Signature 

My Blog, C2D, PHP Videos, Résumé, Super .htaccess, Extra hooks, and MicroMVC

Profile
 
 
Posted: 14 December 2008 06:28 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  378
Joined  09-11-2006

Also note that you can get core Ajax abilities out of YUI 2.6 in 14kb by loading this URL. That includes the core YAHOO functionality, as well as DOM and Event manipulation/normalization.

 Signature 

August 2011: I’m not an active codeigniter developer right now. Feel free to contact me, but I may not be able to solve your problem for you.

flickr | twitter | rockets

Profile
 
 
Posted: 15 December 2008 12:10 AM   [ Ignore ]   [ # 14 ]  
Grad Student
Rank
Total Posts:  98
Joined  05-26-2008

Seems to me that this thread is more about “this isn’t how i want it done” rather than “this is how i think it should be done”.

I’ve voted no. For me, CI is great because it DOESN’T try and do everything. This is why frameworks like Zend and Cake are so damn heavy - they really try to do everything a dev may want to do. This in itself isn’t bad, those frameworks have their place (especially when dev time is important), but when you want performance, they’re not such a wise choice.

Really, if you want to do AJAX properly, you should be obfuscating your JS completely, and only relying on a lib for the requests (which imo, is rather easy to do yourself). This way, your JS is completely separated from your HTML and makes it very easy to manage, it also keeps your views and controllers nice and clean.

I really see this as a non-issue. It is so easy to write server-side AJAX request handlers it’s ridiculous. And what’s even better is that it will be tailored to your product/service, which means fewer lines to code, and a cleaner application.

I’ve done exactly that for my web-based game.

In short, we don’t need it.

 Signature 

Freelance Web Development - http://www.kirkbushell.com
Also development tutorials, blog posts and random musings.

Profile
 
 
Posted: 15 December 2008 12:12 AM   [ Ignore ]   [ # 15 ]  
Grad Student
Rank
Total Posts:  98
Joined  05-26-2008

Adding to my post above, I would be very displeased if CI tied themselves to a particular library - that was half the problem of rails and cake. If you didn’t like it, you either had to install a 3rd party plugin, or write your own - which meant even more code being parsed in each request.

 Signature 

Freelance Web Development - http://www.kirkbushell.com
Also development tutorials, blog posts and random musings.

Profile
 
 
   
1 of 3
1