ic-patch-to- The Patch-To Attribute
ic-patch-to attribute binds the default action (see below) of HTML element to a
PATCH to the given URL. For example, on a button, when the button is clicked, an
PATCH will be issued to the given URL.
Any content that is returned will be used to replace the content of the current element (or, more commonly, another
element, via the
ic-target attribute, see below). An empty
response will be interpreted as a No-Op. See Intercooler Responses for
Since it is common for an action to replace a different element than the one that the action occured
on, you may want to use the
ic-target attribute to target
a different element for replacement.
The default action depends on the type of an HTML element:
select- A value change.
form- A form submission.
By default, intercooler uses
POST's for all non-
GET requests, due to older browser
limitations. It includes the
_method parameter and the
that indicate the intended HTTP method, but some server-side infrastructure might not understand these conventions.
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:
<meta name="intercoolerjs:use-actual-http-method" content="true"/>
The value of the attribute should be a valid relative path (e.g.
ic-patch-to implies a dependency on its path, and Intercooler will issue requests for elements
whenever it detects an action that the path depends on. See Dependencies for
Here is a simple example, with a span that depends on the updated URL:
<button ic-patch-to="/target_url">Click Me!</button> <span ic-src="/target_url">You haven't clicked yet...</span>