This project has moved and is read-only. For the latest updates, please go here.

Unable to get property 'SPGetCurrentSite' of undefined or null reference

Feb 12, 2015 at 8:05 PM
Hi! Can someone help me with SPServices please, I can't make it work, I tried on a lot of ways, and even make sure that I can see the script on developer view. It's allways the same error, I now have the script on the master page, and the code on NewForm.aspx. Only the JQuery alert works

$(document).ready(function() {
Feb 12, 2015 at 8:14 PM
Are you referencing the SPServices library in the master page as well? Look at the bottom of the first Documentation page for some tips.

Feb 12, 2015 at 8:43 PM
Yes, I'm using the cdn for it, did ctrl + click to see if the URL was wrong, I noticed now that half of the code if comented, see the img does this happened to someone before?
Feb 13, 2015 at 5:03 AM
That's the minified version of the library, at least it looks like it.

What's the error you are seeing?

Feb 13, 2015 at 11:12 AM
Yes, it is, I tried with the not min too, and get the same error, here are the errors,g7iqdR9
Feb 13, 2015 at 12:47 PM
It looks like neither jQuery nor SPServices is defined, given those two errors. Check in the developer tools to make sure that they are loading in the page. I'm guessing that the path you're using, while it may be correct in SharePoint Designer, is not correct for the page itself

Feb 13, 2015 at 1:25 PM
This is what I get, does it means that they loads? I can see the code if I click them
Feb 13, 2015 at 1:52 PM
That shows that they are loading, but the errors you posts show they aren't. I'm not sure what's going on.

Feb 13, 2015 at 2:07 PM
I forgot to tell, the JQuery alerts works well, only the SPServices gives me an error, I will post the solution if I can fix it for others with the same problem, thanks for the help Marc!
Feb 13, 2015 at 2:17 PM
It's definitely an issue with the src links to the script file(s).

I just ran your exact same code in a page that has both jQuery and SPServices loaded and both alerts fired:
Feb 13, 2015 at 2:41 PM
In the past, when I see this type of error reported here it is due to multiple versions of jQuery being loaded. SPServices may be getting attached to the "other" jQuery instance.
Did you check wether a jQuery version was already being used before including your own?

-- sent from mobile
Marked as answer by uhcnamufpy on 2/17/2015 at 3:20 AM
Feb 13, 2015 at 5:40 PM
I did have two versions of jQuery, it was loading 1.10.1 and 1.11.2 fixed that, now I'm with the 1.11.2 version, but still have the same problem, I now have my src like this
Feb 13, 2015 at 5:46 PM
Edited Feb 13, 2015 at 5:46 PM
The ../../ is probably your problem. That may be the right path from where the master page sits, but it won't be from the actual pages. Use relative links like this instead:


Better yet, use a CDN.

Feb 13, 2015 at 6:25 PM
I'm using a cdn now for jQuery and SPServices, the two scritps are loading too, it's still the same, here is what the console shows to me
Feb 13, 2015 at 6:28 PM
Can you please show your script references? Not an image; the script tags you have in the page.

Feb 13, 2015 at 7:04 PM

<script type="text/javascript" src="//"></script>
<script type="text/javascript" src=""></script>
Feb 13, 2015 at 9:11 PM
That looks right. You should be able to tell in the developer tools whether the two files are actually loading. At thing point, I think you'll just need to do some more debugging.

One thing you should check: you're specifying https in the src for SPServices. If your SharePoint site isn't running https, you'll get an error.

Feb 13, 2015 at 11:55 PM
Your screen capture showed SPServices script tag in the page before jQuery. If that is accurate, and you truly only have 1 version of jQuery, then there should have been an error when SPServices loaded because jQuery would not be there.
Also, if that was a screen capture of a master page, you may have other issues because you are using relative paths.

-- sent from mobile
Feb 16, 2015 at 11:43 AM
It finally worked! I needed one line extra line of code, it was "jQuery.noConflict(); ", now it works great!
Thanks for your help!
Feb 16, 2015 at 3:26 PM
You should figure out why you have multiple versions of jQuery loading in the page rather than just papering over it. Perhaps your IT folks are loading it in the master page or something. There's not need for you to load it if it's already available.

Marked as answer by uhcnamufpy on 2/17/2015 at 3:20 AM
Feb 17, 2015 at 11:21 AM
I fixed that now, again, thanks for your help! I don't need to use jQuery.noConflict() now