the Future of the Web
  • Home
  • Hire Us
  • Articles
  • About
  • Contact
  • Unobtrusive Ajax

    Jul 27 2007

    I wrote a Short Cut for O'Reilly that just came out called Unobtrusive Ajax. You can buy it online for just $9.99.

    It's a 57-page PDF that goes into depth on using JavaScript and Ajax unobtrusively, an extension of my Unobtrusive Ajax presentation. From the description:

    Unobtrusive Ajax is about making web applications that work for everyone all the time, even if you have JavaScript turned off, or you're using a mobile phone or a screen reader, or however you happen to be using the Web. It's about the separation of behavior (JavaScript), content (HTML), and presentation (CSS).

    This short cut will focus on the practical benefits of using Ajax and JavaScript unobtrusively and show you that unobtrusive web development and progressive enhancement benefit both web developers and users of the Web. You'll get to see many simple examples of building web interfaces that are unobtrusive. You'll quickly see that it is actually very easy to make web applications that everyone can use.

    When you're finished reading this short cut, you will be able to convince anyone why developing unobtrusively is the best way to build a site with JavaScript and Ajax.

    I'd like to give a big thanks to the king of Unobtrusive JavaScript, Christian Heilmann, for giving me a great technical review.

    If you're into this sort of thing, or even if you're not but wondering if you should be, I recommend you check it out.

    Tags: javascript oreilly unobtrusive ajax
    View 1 Comment | Add a comment
  • Confusing JavaScript Equality

    Jul 25 2007

    I got tripped up today by something that took me a few minutes to figure out. I wrote this:

    if (a == b == 0) {
        // only execute if both a and b are zero
    }
    

    But this was wrong. In fact, you can write this:

    alert(3 == 4 == 0); // alerts "true"
    

    Why is that? Because of the order things are evaluated. I made the mistake of thinking == has the same result as doing =:

    var x, y;
    
    x = y = 10;
    
    alert(x); // 10
    alert(y); // 10
    

    But when you use == like that, it actually compares the firsts two values, then compares the result (true or false) against the 3rd value. It's the same as writing:

    alert(3 == 4 == 0); // true
    alert((3 == 4) == 0); // true
    

    because 3 == 4 is false, and false == 0 is true!

    Tags: javascript
    View 2 Comments | Add a comment
  • Hidden Ajax Errors with jQuery

    Jul 5 2007

    If you use Ajax with jQuery, you may have noticed that you don't get any error messages when things go wrong. Even if you have major bugs in your callback functions, jQuery just silently fails, sweeping any errors under the rug, and leaving you clueless as to what just happened.

    For example, you can do this and you won't get any errors:

    $.get('page.html', function(){
        this_function_does_not_exist();
    });
    

    There are two ways to fix this. You can use $.ajax with the error parameter, passing an error handling function for that particular Ajax call. Or, you can define a global Ajax error handler. If you do a lot of Ajax, and you use Firebug, the latter is a great option. Try this:

    $(document).ajaxError(function(){
        if (window.console && window.console.error) {
            console.error(arguments);
        }
    });
    

    After running this code, you'll start getting error messages in your Firebug console (if anything breaks with your Ajax calls or callbacks). The error messages aren't the greatest, but at least you don't have to stay in the dark any longer.

    Tags: javascript jquery ajax
    View 5 Comments | Add a comment
  • Drag and Drop on QuirksMode

    Jul 2 2007

    Peter-Paul Koch has put together yet another masterful overview, this time covering Drag and drop, something that has been on my to-do list for over a year. His script even works with just the keyboard! Not only does he offer a great Drag-and-drop script, he explains how it was written so you can better understand how Drag-and-drop works in JavaScript (and take it apart or put it together yourself).

    Tags: links draganddrop javascript quirksmode ppk
    View 1 Comment | Add a comment

  • Request a Quote

  • Jesse Skinner

    Jesse Skinner
    • Hire Me
    • About Me
    • Email Me
    • RSS Feed RSS Icon
  • Recent Articles

    • Parse Accept-Language to detect a user's language
    • Twitter
    • Three years of The Future of the Web
    • Saving data to a file with PHP
    • Easy web scraping with PHP
    • See all the articles
    • IBM: Where and when to use Ajax
    • Code Igniter 1.6.0 Released
    • Update a Dev Site Automatically with Subversion
    • JavaScript Functions are Variables
    • See All...
  • Categories

    • javascript (37)
    • links (19)
    • about (18)
    • web (14)
    • server (10)
    • html (10)
    • css (8)
    • carnival (7)
    • browsers (7)
    • design (4)
    • seo (4)
    • ads (4)
    • standards (4)
    • events (4)
    • work (4)
  • Older Articles

    • May 2008
    • April 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • January 2007
    • December 2006
    • November 2006
    • October 2006
    • September 2006
    • August 2006
    • July 2006
    • June 2006
    • May 2006
    • April 2006
    • March 2006
    • February 2006
    • January 2006
    • December 2005
    • November 2005
    • October 2005
    • September 2005
    • August 2005
    • April 2005
    • See All...
Copyright © 2008 Jesse Skinner | CSS | XHTML | RSS | Help | Impressum | Cutie Quilts | Internet Blog Top Sites