-
Notifications
You must be signed in to change notification settings - Fork 22
JavaScript Methods
James R. Griffin III edited this page Oct 11, 2018
·
4 revisions
You can trigger browse-everything
using either data attributes (see the README) or by calling one of these JavaScript methods
You can trigger browse-everything like this:
$('#browse').browseEverything(options)
Attaches the browsing behavior to the click event of the receiver.
$('#browse').browseEverything({
route: "/browse",
target: "#myForm"
}).done(function(data) {
// User has submitted files; data contains an array of URLs and their options
}).cancel(function() {
// User cancelled the browse operation
}).fail(function(status, error, text) {
// URL retrieval experienced a technical failure
});
Returns the existing callback object for the receiver, allowing for a mix of data attribute and JavaScript modes.
<button type="button" data-toggle="browse-everything" data-route="/browse"
data-target="#myForm" class="btn btn-large btn-success" id="browse">Browse!</button>
<script>
$(document).ready(function() {
$('#browse').browseEverything().done(function(data) {
// Set the "done" callback for the already-defined #browse button
})
});
</script>