I have a vf component in a page which includes a static resource. In the resource, I have a apex method call. Since I am using the same resource in a custom button also, I am using AJAX tool kit instead of @RemoteAction
. So, I have added connection.js
and apex.js
files in the component. When the page is loaded, I see this error in console.
my component includes the files like this:
<apex:includeScript value="/soap/ajax/32.0/connection.js"/>
<apex:includeScript value="/soap/ajax/32.0/apex.js"/>
<apex:includeScript value="{!$Resource.myStaticResource}"/>
From the javascript console, I understand that sforce is not recognized by browser, but I'm loading the connection.js
file before apex.js
. What could be the issue here?
Update:
Does browser or its cache memory has to do anything with this? because If I refresh the page after I saw this issue in dev console of Chrome, ...the error is gone. Why the sforce object is not recognized in the first load of the page itself?