jQuery SPServices is null or not an object

11 May

Accessing a SharePoint list with the jQuery SPServices is very cool and neat! But I just discovered an issue with it:

Sometimes you get a message: ‘SPServices’ is null or not an object.

Make sure you reference the ‘base’ jquery first, then the services js file:
<script type=”text/javascript” src=”ICTLibrary/jquery.3.2.min.js”></script>
<script type=”text/javascript” src=”ICTLibrary/jquery.SPServices-0.5.4.min.js”></script>

<script language=”javascript” type=”text/javascript”>
 var userName = “”;

$(document).ready(function()
{
 alert(“ready”);
 userName= $().SPServices.SPGetCurrentUser({
  fieldName: “Title”
 });

alert(userName);
 });

</script>

AND make sure you close all tags and functions properly!!

9 Replies to “jQuery SPServices is null or not an object

  1. Hey, I found your blog in a new directory of blogs. I dont know how your blog came up, must have been a typo, anyway cool blog, I bookmarked you.

  2. Try removing the functionality from “(document).ready ”
    It tries to run SPServices function before the JS is loaded in the browser and hence fails most of the times.

  3. Hi

    Thanks for the post: Make sure you reference the ‘base’ jquery first, then the services js file: this solved my problem.

Comments are closed.