SPServices is null or not an object

May 6, 2011 at 9:50 PM

I had been using jquery.SPServices-0.5.7.min.js with jquery-1.4.4.min.js successfully.  When I decided to upgrade my jQuery to jquery-1.5.1.min.js, I realized that I needed the latest SPServces.  I upgraded my SPServcis library to 0.6.1 to work with jQuery 1.5.1.  I get an error that says SPServices is null or not an object.This is with the same code that works in previous versions.  I created a test case and it fails also:

 

$(document).ready(function(){

    var thisSite = $().SPServices.SPGetCurrentSite();
    alert(thisSite);
});

 

I did test the jQuery and it is working fine.  This same method works fine in previous versions.  I have redownloaded the library in case I had a corrupt one.

 

Any ideas?

Coordinator
May 6, 2011 at 10:15 PM
That message means that the reference to the .js file is wrong, about 98% of the time. Make sure the file is where you think it is. In SharePoint Designer you can Ctrl-Click the URL, and if it's valid, the .js file will open.

M.
>
May 6, 2011 at 10:37 PM
OK. I got it to work. It was weird. I just changed the version numbers and it stopped working even though both versions were in the same folder. I did find out that the master page is loading version 1.4.2 of jQuery and so when I was trying to load a later version, I don't know what that ended up doing. I am still confused as to why it would work with the older version but the newer version it doesn't work. I tried to use a relative URL /resources/js/jquery.SPServices-0.6.1.min.js and it was working, now I have to use /sites/executives/resources/js/jquery.SPS-0.6.1.min.js.

Thanks Marc.

On Fri, May 6, 2011 at 4:15 PM, sympmarc <notifications@codeplex.com> wrote:

From: sympmarc

That message means that the reference to the .js file is wrong, about 98% of the time. Make sure the file is where you think it is. In SharePoint Designer you can Ctrl-Click the URL, and if it's valid, the .js file will open.

M.
>

Read the full discussion online.

To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com)

To start a new discussion for this project, email SPServices@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


May 6, 2011 at 10:41 PM

Can you confirm whether SPServices 0.6.x will work with versions of jQuery prior to 1.5.x?  I'm trying to figure out why my code works when I think it shouldn't!

-Dave

Coordinator
May 7, 2011 at 4:42 AM

I still think that you may not have the files exactyl where you think, or at least not where they were before.

If /resources/js/jquery.SPServices-0.6.1.min.js worked before, and now it needs to be /sites/executives/resources/js/jquery.SPS-0.6.1.min.js, those are two different location (obviously). It may be that you simply deployed the file to a different location.

SPServices 0.6.x will work with versions of jQuery prior to 1.5.x (down to 1.4.2, anyway), but SPServices versions less than 0.6.0 will not work with jQuery versions 1.5+.

M.