Speaking of ajax, do any of you use libraries like scriptaculous, moo, jquery, or cross-browser? If so, what are your experiences incorporating them with PHP?

If it were up to me, I could care less about the design elements ajax provides, but these days it seems to be difficult to find a client who agrees... Is it worth taking the time to really learn advanced JavaScript, or are the libraries good enough?

    It's probably just a sign of my ignorance and perhaps not having done anything complex enough to date, but so far I've gotten by fine with one JavaScript function I found somewhere on the 'net, making a few very minor modifications to it as needed, and perhaps creating the odd JS function or two of my own as needed. The PHP end of things has been simple enough for me (I know PHP much better than I know JavaScript). Therefore, I've really not yet run into a situation where I felt I needed some fancy AJAX library to accomplish what I've needed to do.

      Im my honest opinion, ajax libraries complicate things more then then help. Ajax isnt difficult by any means, and pretty much everythign I do now adays has ajax in it. Once you get into the habit of it, it does provide for some good usability.

      However what I find a disturbing trend is the fact this "simple trick" which I will admit does provide powerful fucntionality, is being completely misunderstood, mismanaged and overplayed.

      I hear of business 2.0 and how web 2.0 is revolutionizing blah blah blah...
      Yes, ajax is great, but your whole business model is based on a javascript header object? And my bosses have on several occasion told me to ajax a static page, or "instead of using java(script), use ajax" or "do you konw the ajax language",
      or asking me ajax the navigation because it used drop downs.

      I use to fight them and explain it, now I just like "okay.. whatever"

      But back to the subject, libraries are great for people unfamiliar with js and or ajax who want to quickly build things, and it is true prototype and other libraries have been tested and it is good to have a solid piece of software, but as "liberating" as it is to not have to worry about the basic elements, it is also limiting you to a great extent to rely on, and not know how to expand the library, or even go your on way on applications. I also think that like all things, with programming you get what you pay for. Cutting production time is one thing, but racing to get applications up quickly is just poor development. I see ads promoting "build an application in 30 minutes", which technically you could. But then it will work and function like an application built in 30 minutes. There is no substitute for quality, thorough development and that takes time.

      I'm no guru by any means, but because I figured out how to implement ajax before I found out about these libraries, I find them cumbersome, and am unmotivated to spend time figuring out how to use a program to let me do something I can figure out faster on my own.

      Maybe I'm behind on something, but I see people asking alot how to integrate ajax and libraries into php. I honestly cannot imagine a scenario where the PHP would or should affect the js libraries. I will be easier to have your js ready for your server's response then to have the server side language dictate the javascripting. At best, your server side language and client side should remain independent for portability.

      Although, I cannot disagree there arent circumstances out there that do require PHP input into the js libraries. But at that point it comes down to the library designer and the programmer him/her self to integrate. The best libraries in the world cannot predict the endless ways you can tackle a problem

      Hope that was enough of a read

        I've played around with ExtJS and it could do some cool things. It integrates well with PHP imho -- I just used SimpleXML to interact with the JS side of things. I thought the learning curve was pretty high though, and the documentation was a bit lacking -- but this has been months ago, so it may be better now. Also, my JS skills are teh suck so I'm sure that would help 🙂

          ive never played with much javascript/ajax anything, but ive wondered many times about it...i really wanna get into and learn some more but time is a rarity to come by. everytime i use Codango and see the ajax library category i sort of wonder..."maybe i should just play with some for a while" haha...

          im not sure how necessarily helpful they are...but for anyone who's wondering...
          http://codango.com/php/dir/components/ajax/

          rulian...you share some interesting thoughts / truths on the matter too..thank you for the insight!

            Thanks for the replies guys...

            "instead of using java(script), use ajax"

            Haha - yes I've had clients ask for widgets and when I asked them what exactly they mean by that, they're stumped. Isn't a widget something that looks like this? Oh, no... that's midget. Maybe something like this? Wait, that's gadget. I don't know... 🙂

              Like Elizabeth, I too have been looking at ExtJS. I needed something with tabbed panels, editable grids, trees and drag and drop. The AJAX component was somewhat incidental. So far at least, ExtJS seems to be doing the job.

                I've actually only really worked with scriptaculous. It's not so much for ajax. In fact, its link to ajax is the fact that it bundles prototype which is not from the author of scriptaculous. scriptaculous provides alot of animation/eyecandy that is comparible (but lacking because there's only so much you can do moving layers around with javascript) to flash (I actually found it very useful for ui.) As NogDog points out, ajax is pretty much just "one function". And that would be a wrapper function for the javascript object called XMLHttpRequest. This simply allows javascript to POST and GET just like a web browser and effectively turns your javascript app into it's own little browser so your webpage feels more like an individual application (interactivity w/o having to reload web page.)

                Allbeit, that wasn't so much your question. I have found scriptaculous/prototype useful for easily incorporating inline editing. One feature i put in a page for a client was a list that refreshes almost in real time (3 second loops.) In another project. I made an itinerary where users drag and drop their items into days that they plan to visit. Again, scriptaculous provided the drag and drop (ui) and built-in prototype wrapped the XMLHttpRequest object in its many facades to store the information in the database. Kewl stuff very easy to use.

                  rulian wrote:

                  But back to the subject, libraries are great for people unfamiliar with js and or ajax who want to quickly build things, and it is true prototype and other libraries have been tested and it is good to have a solid piece of software, but as "liberating" as it is to not have to worry about the basic elements, it is also limiting you to a great extent to rely on, and not know how to expand the library, or even go your on way on applications. I also think that like all things, with programming you get what you pay for. Cutting production time is one thing, but racing to get applications up quickly is just poor development. I see ads promoting "build an application in 30 minutes", which technically you could. But then it will work and function like an application built in 30 minutes. There is no substitute for quality, thorough development and that takes time.

                  What's the saying? "Programmers are lazy." Personally I see no problem in using a freely available library from someone more knowledgeable than you. I do not believe in reinventing the wheel when the car runs fine. If I want to understand how the car works, when I feel like I have time, I'll pop the hood/bonnet open and have a look. Yes, if the car is a lemon, you may wanna build your own car.

                    That's not quite what I am saying. I say libraries are great for cutting production time, it is a common practice for developers to use "recyclable" code, we do it all the time for db wrappers and common / useful functions. It is also a great idea to use software that's been tested and known to work well. That's is the benefit of public open source libraries.

                    But to address something you said, I do have a problem with lazy programmers who's abilities rely on the works of others. I dont have a problem with people looking to more experienced developers for solutions. One of the things I like about our industry is how intimately we work with and help each other out.
                    Now, to use your metaphor, it's fine to not know engines when you are just the driver, but if you say you are a mechanic you should really make the effort. So maybe my comments are directed more towards working professionals if that clarifies my point. I certainly dont mean to discourage people who dont know ajax or js from using libraries. But understand that they are simply tools, and if you are going to truely be effective with them, you cant rely on them to be your sole solutions.

                    Now there are related industry trends I would love to discuss about open source, the job market and a host of other issues, but that is a different thread for a different day.

                    btw, "so long thankx for the fish" one of my favorite films ever!!!

                      And other thing, ive used extjs and prototype and yui and mootools and scriptalicious, I find that by the time i'm done stacking and combining and figiting and meshing these scripts together is often less quality then just using more core, basic functions and addressing your problem directly.
                      I find it to be like a virtual game of jenga.

                        rulian wrote:

                        I find it to be like a virtual game of jenga.

                        Or trying to output html content with ASP.NET. You just give up and write your own 🙂

                        I really do agree with you. I think it just depends on the complexity of the project you are undertaking. If your needs are too simple, why not "roll" your own. If your needs are too complex, it's hard to beat a square into a circle (man...I'm all about metaphors today.)

                          i know this is a little old now...but I was just rereading through and theres some interesting things to look into...

                          thanks for the great info guys 😃

                          I'll have to be doing some more reading on some of this......

                            Write a Reply...