Yulia-Anaplan
4 years agoGuide
Any cons of NOT using LITHIUM.jQuery when calling an endpoint from a component?
Hi folks, I was wondering if using LITHIUM.jQuery when calling endpoints is the only preferred way of doing it: <@liaAddScript>
;(function ($) {
$(document).ready(function () {
functio...
- 4 years ago
There are no specific issues with using vanilla javascript to call endpoints.
Using LITHIUM.jQuery is recommended if you intended to use jQuery.
Also, using liaAddScript is recommended if you need the code to be executed near the bottom of the page after OOB javascript has executed (It may also do some minification/obfuscation).
If none of those situations apply or are of concern, feel free to use plain JS in <script> tags. I would just encourage you to be mindful of code organization so the JS makes sense where it is placed, isn't repeated by multiple component includes, etc....