I was roaming around the internet for this question.

I want to use include jquery first then mu custom js which uses jquery.

After the above steps, I want to call a function from my custom js which will take my json data's value returned by apex. ie. customeJSFunction(jsonValueArg)


1 Answer 1


You can use loadOnReady attribute on apex:includeScript - meaning, that library will load only after DOM is constructed. For script you dont have such capability.

Also apex:includeScript docs:

Multiple references to the same script are de-duplicated, making this component safe to use inside an iteration component. This might occur if, for example, you use an inside a custom component, and then use that component inside an iteration.

Interesting read on script tag:

  • If async is present: The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing)
  • If async is not present and defer is present: The script is executed when the page has finished parsing
  • If neither async or defer is present: The script is fetched and executed immediately, before the browser continues parsing the page
  • For the script tag, you can use the async or defer attribute. loadOnReady simply uses defer.
    – sfdcfox
    Jul 25, 2019 at 13:12
  • @sfdcfox Thanks sfdcfox!! Jul 25, 2019 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.