function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
apex_keenapex_keen 

Using jquery in VF page

I've very basic problem. I'm trying to use jquery library inside my vf page. Downloaded latest library(zipped) and uploaded it as static resource in Salesforce .

Using this syntax to refer the JS files of  jquery : 

<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.8.3.min.js')}" />

<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.9.2.custom.min.js')}"

<apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.9.2.custom.css')}" />

 

But as soon as  i try to save the page, I found using 'chrome development console' that these files are not found( 404 error).

Already verfied- In zipped folder, all these files are correctly present  in their respective folders( JS or CSS )and static resource is correctly named as jquery in Salesforce. 

Any idea, where could be the issue. 

bob_buzzardbob_buzzard

I wouldn't expect you to need the leading '/' character.

 

Try:

 

<apex:includeScript value="{!URLFOR($Resource.jQuery, 'js/jquery-1.8.3.min.js')}" />

 

apex_keenapex_keen

Hi Bob,

 

Thanks for your reply but unfortunately, this has not solved the problem.

 

One thing to note,  on saving and then using chrome development console-

 URL( which is not found ) is shown something like this : 

 

GET https://c.ap1.visual.force.com/resource/1354530432000/jquery/js/jquery-1.8.3.min.js 404 (Not Found)

GET https://c.ap1.visual.force.com/resource/1354530432000/jquery/css/ui-lightness/jquery-ui-1.9.2.custom.css 404 (Not Found)

 

How this URL is created by force.com engine ? what this big number in between URL(1354...) represents ?

bob_buzzardbob_buzzard

Its a timestamp.  You can find full details at:

 

http://wiki.developerforce.com/page/Delivering_Static_Resources_with_Visualforce

 

If you expand your zipped static resource, what is the resulting structure?  It sounds like the top level directory isn't 'jquery' - is there an additional directory in there?