jQuery vs MooTools (1 vote for the former)

I spent the best part of the morning trying to figure out why a simple Ajax call with MooTools wouldn’t work correctly.

I was either getting no response and various script errors caught in
FireBug, or jumping straight to the target URL, no Ajax happening.

I would have wasted more time trying to fix bugs in this had I not tried to do the same thing in jQuery.

With jQuery, it took me all of 1 minute to produce the desired result.

I haven’t really spent any time with JavaScript before and only hear from friends which framework they like best.

I’m sure for different things each has its own strengths, but I am adding a vote of confidence to jQuery!

Here’s the simple code to get a DIV replaced with the output of a PHP call:

HTML file contents





Your Page Title










Click to load content from PHP

PHP output will be shown here

This will replace the contents of the DIV with whatever is output normally by the PHP script.

You will need to download and add the jquery.js file to the same
folder as this file. You will also need to put your php file in the same
folder and run it all on a web server to see results.

To learn about running a test web server for free on your own computer, please browse my other posts.

Share on twitter
Twitter
Share on reddit
Reddit
Share on telegram
Telegram
Share on email
Email
Share on print
Print

Site made with love of these open source tools

The beautifully-crafted OS that forces you to learn how to do things properly.

For better or worse, WordPress powers 30% of the web. ClassicPress reduces some of the bloat.

Text is my material. Learn one text editor well.

Version controlling all the things.

Retaining workspaces on local and remote servers.

Supporting the OpenBSD community with opinionated VMs. €10/yr donated to the OpenBSD Foundation.

To Roman Zolotarev, for helping us Master the Web. My family and friends for enduring my voluntary financial hardship while pursuing my passions.