--- layout: default nav: docs ---

Getting To Intercooler

Consider the humble anchor tag, foundation of the web:

<a href="http://www.google.com">Click Me</a>

This bit of HTML tells the browser:

"When the user clicks on this anchor tag, issue an HTTP GET to http://www.google.com and replace the current page with the response."

Let's break this sentence down into its components:

"When [the user clicks on] this [anchor tag], issue an [HTTP GET to http://www.google.com] and replace [the current page] with the response."

Intercooler generalizes each of these components:

  • [the user clicks on] - ic-trigger-on lets you specify the event that causes the request.
  • [anchor tag] - Intercooler attributes work on any element, not just anchor tags.
  • [HTTP GET to http://www.google.com] - Using the ic-post-to, ic-put-to, ic-delete-from and ic-get-from attributes, you can make use of the full catalog of HTTP actions.
  • [the current page] - You can use the ic-target attribute to target any particular element for replacement.

To give a general form to the original statement:

"When X this Y, issue a Z and replace P with the response."

This generalization and extension of the traditional patterns of web development lets you create rich user interaction while minimizing the associated conceptual and complexity burdens. As you peruse the examples section you will be surprised how many UX patterns normally associated with heavy javascript can be implemented using this simple pattern.

See the documentation to find out everything you can do with Intercooler.