O'Reilly logo

Ajax on Rails by Scott Raymond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Context of the Web

So far, we’ve been considering universal principles of usability, nothing web-specific. Every principle, however, must be applied within some context. For every Rails application, the Web is part of that context. So let’s step away from usability for a moment and consider the way the Web works.

HTTP

If you fire up an HTTP sniffing tool to see what is actually sent over the Internet when you browse the Web, you’d see the conversation between your browser and a web server. When you click a link, your browser sends a request like this:

GET /index.html HTTP/1.1
Host: www.oreilly.com
Accept: */*

The first line is the request line—and the first word is the request method, in this case GET. After the method is the path of the URL being requested and the version of HTTP being used. Any following lines are request headers, giving the server additional information to help it fulfill the request.

HTTP methods are sometimes called verbs, because they carry out an action on some object. Just as in everyday speech, there are consequences to using the wrong verb in the wrong context (just imagine the potential consequences of uttering “you’re fired” or “I thee wed” in the wrong contexts). HTTP methods have the same kind of potential to effect change, so they should be selected with care.

The most common HTTP method is GET. Any time you enter a URL in the navigation bar, click a standard link, or see an image embedded in a page, that data is requested with GET. According to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required