SharePoint - How to set the reference to jquery file in Visual WebPart ?

Asked By Anish V on 18-Nov-13 05:29 AM
Hi,

How to set the reference to the jquery in Visual Web Part ? I have tried with the below code, but I'm getting error.

<SharePoint:ScriptLink Language="Javascript" Localizable="false" Name ="/Js/jquery-2.0.2.min.js"
    runat="server"></SharePoint:ScriptLink>


I'm getting error like this...

Cannot make a cache safe URL for "/Js/jquery-2.0.2.min.js", file not found. Please verify that the file exists under the layouts directory.

Please help.

Regards,
Anish
Robbe Morris replied to Anish V on 18-Nov-13 08:44 AM
This is root addressing which means it is looking for the file in a folder named "js" right below the root of the web site.  Is that what you intended?

"/Js/jquery-2.0.2.min.js"

The error message seems to indicate that it is looking for the file under the layouts directory.

Perhaps it should be "/layouts/Js/jquery-2.0.2.min.js"