2

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' });
}
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.