intercooler
Version:
Making AJAX as easy as anchor tags
29 lines (21 loc) • 1.5 kB
HTML
<p>Any content that is returned will be used to replace the content of the current element (or, more commonly, another
element, via the <code><a href="/attributes/ic-target.html">ic-target</a></code> attribute, see below). An empty
response will be interpreted as a No-Op. See <a href="/responses.html">Intercooler Responses</a> for
more info.</p>
<p>Since it is common for an action to replace a <em>different</em> element than the one that the action occured
on, you may want to use the <a href="/attributes/ic-target.html"><code>ic-target</code></a> attribute to target
a different element for replacement.</p>
<h3>What is the Default Action?</h3>
<p>The default action depends on the type of an HTML element:</p>
<ul>
<li><code>input</code>, <code>select</code> - A value change.</li>
<li><code>form</code> - A form submission.</li>
<li>Everything else - A click.</li>
</ul>
<h3>Using Real HTTP Methods</h3>
<p>By default, intercooler uses <code>POST</code>'s for all non-<code>GET</code> requests, due to older browser
limitations. It includes the <code>_method</code> parameter and the <code>X-HTTP-Method-Override</code> headers
that indicate the intended HTTP method, but some server-side infrastructure might not understand these conventions.</p>
<p>If you wish to use the actual HTTP method and forgo older browser support, you can use the following meta tag
in your head tag:</p>
<pre><meta name="intercoolerjs:use-actual-http-method" content="true"/></pre>