+ Start a Discussion
mukesh guptamukesh gupta 

Static resource is not working in Lightning

Hi Expert,

I am using below code in my lightning componant but facing error "Jquery_File/jquery-3.3.1.min.js 404 (Not Found)" in browser console.

here "Jquery_File" is static resources name and 
 <ltng:require scripts="{!$Resource.Jquery_File + '/jquery-3.3.1.min'}" />

https://testnewdomian-dev-ed.livepreview.salesforce-communities.com/sfsites/c/resource/1535093740000/Jquery_File/jquery-3.3.1.min.js 404 (Not Found)

Thanks
Mukesh

 
bhanu_prakashbhanu_prakash
Hi Mukesh,
Mark as best answer, If it resloves !!​
upload your jquery file in static resource and use below code
<aura:component>
    <ltng:require scripts="{!$Resource.yourResourceName + '/yourFileName.js'}" />
</aura:component>

reference: 
https://jennamolby.com/how-to-use-jquery-libraries-within-salesforce-lightning-components/
http://sfdcmonkey.com/2018/03/13/jquery-datatable-salesforce-lightning-component/

Mark as resloved if it helps :) :)
Thanks, 
Bhanu Prakash
visit ForceLearn.com

 
Raj VakatiRaj Vakati
try this code

    <ltng:require scripts="{!$Resource.Jquery_File}" />