<p>Keep in mind passing a new settings object will destroy all previously attached events. If you want to preserve the events, you can trigger a new request with the the <code>query</code> behavior</p>
<p>If many elements trigger a similar function, it is often easiest to include unique url data in each triggering element. For example, many follow buttons will trigger the same endpoint, but each will have its own user id.</p>
<h4 class="ui header">Data Attributes</h4>
<p>You can include url values as metadata inside the DOM.
<p>This is often easiest to include unique url data for each triggering element. For example, many follow buttons will trigger the same endpoint, but each will have its own user id.</p>
<div class="code" data-type="html">
<div class="ui follow button" data-id="11">
User 1
@ -238,8 +254,29 @@ type : 'UI Behavior'
</div>
<div class="no example">
<h4 class="ui header">...returned values from beforeSend Callback</h4>
<p>In addition all parameters can be adjusted in a special callback <code>beforeSend</code> which occurs, quite intuitively, before the API request is sent.</p>
<h4 class="ui header">...specified in beforeSend Callback</h4>
<p>All run settings, not just url data, can be adjusted in a special callback <code>beforeSend</code> which occurs before the API request is sent.</p>
<p>You can also use this callback to adjust other settings before each API call</p>
"message": "We've retreived your data from the server"
"data": {
// payload here
}
}
</div>
<p>Your success test recieves the servers json response, and should return true or false on whether the result should be considered successful. Succesful results will trigger <code>onSuccess</code> unsuccesful results <code>onFailure</code> but not <code>onError</code>, this is reserved for responses which return <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest">XHR</a> errors.</p>
<p>The success test function recieves the servers json response, and returns whether the result should be considered successful. Succesful results will trigger <code>onSuccess</code> unsuccesful results <code>onFailure</code> but not <code>onError</code>, this is reserved for responses which return <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest">XHR</a> errors.</p>
<td>Selector filter for elements that should not be triggerable</td>
</tr>
<tr>
<td>stateContext</td>
<td>this (selector/DOM element)</td>
<td>UI state will be applied to this element, defaults to triggering element.</td>
</tr>
<tr>
<td>defaultData</td>
<td>true</td>
<td>Whether to include default data like {value} and {text}</td>
</tr>
<tr>
<td>serializeForm</td>
<td>(true, false)</td>
<td>Whether to serialize closest form and include in request</td>
</tr>
<tr>
<td>throttle</td>
<td>0</td>
<td>If a request is pending, additional requests will be throttled by this duration in ms. (Setting above 0 will allow multiple simultaneous requests)</td>
</tr>
<tr>
<td>regExp</td>
<td>
<div class="code" data-type="css">
regExp : {
required: /\{\$*[A-z0-9]+\}/g,
optional: /\{\/\$*[A-z0-9]+\}/g,
}
</div>
</td>
<td>Regular expressions used for finding variables in templated urls</td>