I am using google ajax api
How can I load custom js which depends on libs loaded by ajaxapi?
I am using google ajax api How can I load custom js which depends
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could define a function that inserts the script object into the DOM like
and either use it as
google.setOnLoadCallbackor, if you want to load it with a specific Google library that you load, as a callback for that method, ie.
Update: Based on your comment, you could try to use jQuery.getScript which provides a callback function for the (externally) loaded JavaScript code. According to HubLog: Google, jQuery and plugin loading, you may have to use
window.setTimeoutto delay the execution of a function until the script(s) has/have eval’d.Since jQuery and it’s plugins are probably loaded asynchronously, you may need to use unobtrusive JavaScript instead of using jQuery/plugin functions in the HTML code directly.