howto: reference script in visual web part

Jul 23, 2010 at 8:56 PM

I dont want to add the script to a document library.  I want to deploy it and jquery as application resources.  I do not have access to the master pages or the file system (beyond the wsp).  Does anyone have a working sample of markup that works this way.  I know how to create the wsp and the scripts DO get deployed to the proper place but they seem to be ignored.

Deployment location: {WebApplicationRoot}\Resources\Training\QT\jquery\ I have verified that after deployment and feature activation the files are in  C:\inetpub\wwwroot\wss\VirtualDirectories\80\resources\Training\QT\jquery\jquery-1.4.2.min.js  

http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js <- if I reference this it works but I have a closed system.

<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<script src="~/resources/Training/QT/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () 
    {
        alert("JQUERY WORKS!!");
    });
</script>
Thanks in advance,
Coordinator
Jul 24, 2010 at 1:13 PM
Seems like an odd place to deploy the script files (overkill), but if they are there, then it's just a matter of getting the reference right in your script tag. I think the ~ is your problem. M.