SP2007 $().SPServices Undefined

Feb 12, 2014 at 4:27 PM
I'm working in implementing SPServices in SP2007, but I'm having problems getting started. I'm following this guide, but unable to get the second step to work.

I've added the js files to the head tag and confirmed that they are linked correctly. Here's the output of the tags to illustrate they are in the correct order:
<script type="text/javascript" src="/scripts/jquery-1.10.1.min.js" id="link1"></script> 
<script type="text/javascript" src="/scripts/jquery.SPServices-2013.02a.min.js" id="link2"></script>
<script type="text/javascript" src="/scripts/gallery.js" id="link3"></script>
When I add the following to the gallery.js file I only get the 'jQuery' alert.
Debugging the JS in chrome, I get $().SPServices is undefined. I've confirmed that there is only one call to jQuery....js.

What could I be missing?

Thanks in advance.
Feb 12, 2014 at 4:51 PM
Generally this would indicate that the path /scripts/jquery.SPServices-2013.02a.min.js isn't correct or that the file isn't there.

Feb 12, 2014 at 5:03 PM
I've confirmed that the file is there using chrome developer tools -> resources, as well as, navigating to it in the browser.

I did notice a "Failed to load resource: the server responded with a status of 404 (NOT FOUND) http://sp2007-dev/scripts/jquery-1.10.1.min.map" when the page loads.
I'm investigating further, but could it be related?
Feb 12, 2014 at 6:21 PM
I'm not sure what that message is. (I don't know what the .map bit would be.)

In Firebug, I can see whether each script file is loading. I assume you can do the same in the Chrome dev tools?

Feb 12, 2014 at 6:43 PM
I resolved the min.map warning, but it did not fix this issue.

In firefox console, I see the following "GET http://[hostname]/scripts/jquery.SPServices-2013.02a.min.js [HTTP/1.1 304 NOT MODIFIED 16ms]"
Feb 12, 2014 at 6:50 PM
Seems like it's loading, then. I don't see anything in what you're doing that should cause a problem.

Feb 13, 2014 at 11:33 AM
If all script files are loading and you still get undefined for SPServices, then I suspect you may have two versions of jQuery loading. SPServices may be getting bound for the version of jQuery that you don't have a regerrence to. Do a 'view source' on the page and search for jquery.

After the page loads, are you able to access SPSservices from the console? Example, this should report that it is a function:


Re: the map file
That was just the Chome dev tools telling you it can't find jQuery map file for the minefield version.

Paul T.

-- Sent from Mobile

Feb 13, 2014 at 12:42 PM
Doing a search of source for "jquery", the only files I found are "jquery-1.10.1.min.js" and "jquery.SPServices-2013.02a.js" (I switched to the non-minified version, but it did not help.).

$.fn.SPServices returns "undefined" in chrome console.

For reference, here's a list of all the ".js" files loaded on the page:
Sharepoint js files
  • core.js
  • EditingMenu.js
  • init.js
  • non_ie.js
  • portal.js
  • search.js
  • Serialize.js
  • SpellCheckEntirePage.js
  • WebResource.axd
Custom js files
  • jquery-1.10.1.min.js
  • jquery.SPServices-2013.02a.js
  • cafe.js (jCarousel specific script, only 10 lines)
  • gallery.js (file where I'm writing the SPServices scripts)
Feb 13, 2014 at 6:53 PM
I'm running out of ideas...

Question: is your _$(document).ready() wrapped in a closure? like this:
My last attempt... Since I don't have access to your env., try this which will print out some data that hopefully can point you in the right direction.:
<script type="text/javascript">
    alert("1. is $ defined? " + ( typeof $ === "undefined" ? "NO - Good.. We'll load it next." : "YES - Oh oh... two versions of jQuery!" ) );
<script type="text/javascript" src="/scripts/jquery-1.10.1.min.js" id="link1"></script>
<script type="text/javascript">

    alert("2. is $ defined? " + ( typeof $ === "undefined" ? "NO" : "YES" ) );
    try {
        alert("$ jquery version: " + $.fn.jquery );
    } catch (e) {
        alert("error occurred while trying to figure out jQuery version");


<script type="text/javascript" src="/scripts/jquery.SPServices-2013.02a.min.js" id="link2"></script>

<script type="text/javascript">

    alert("3. is $ defined? " + ( typeof $ === "undefined" ? "NO" : "YES" ) );
    try {
        alert("$ jquery version: " + $.fn.jquery );
    } catch (e) {
        alert("error occurred while trying to figure out jQuery version");
    try {
        alert("SPServices defined in jQuery? " + ( typeof $.fn.SPServices === "undefined" ? "NO - Something is wrong with your SPServices script file" : "YES" ) );
    } catch (e) {
        alert("error occurred while trying to figure out if SPServices was loaded. ");
    try {
        alert("SPServices version: " + $.fn.SPServices.Version() );
    } catch (e) {
        alert("error occurred while trying to figure out SPServices version");

<script type="text/javascript" src="/scripts/gallery.js" id="link3"></script>
Good luck...

Feb 15, 2014 at 8:28 PM

Thanks for taking the time to write that script. Using it clearly confirmed there was an issue loading the SPServices script

Here are the alerts I received:
  1. is $ defined? NO - Good.. We'll load it next.
  2. is $ defined? YES
    $ jquery version: 1.10.1
  3. is $ defined? YES
    $ jquery version: 1.10.1
    SPServices defined in jQuery? NO - Something is wrong with your SPServices script file
    error occurred while trying to figure out SPServices version
For now, I've switched to version 2013.01, which seems to be loading fine. Once I have some extra time I'll look through my references and the 2013.02a version and see if I can identify what is causing me the issue.
Feb 15, 2014 at 8:40 PM
Glad that helped, but I ran out of ideas... :)

Paul T