So let's say I want to load the following library asynchronously:
<%= javascript_include_tag "//code.jquery.com/ui/1.11.2/jquery-ui.js", async:true %>
Now, I want to run the following code after loading the library:
<script>
$('#business_name').autocomplete({ source: '/businesses_finder' });
</script>
How is this done?
It would be really cool if I could call a function following async loading.. Like:
async:true, callback_function: 'autocomplete'
function autocomplete() {
$('#business_name').autocomplete({ source: '/businesses_finder' });
}