I'm currently trying to use SPServices to get the current user who accesses the page. My problem there is that I always get "Syntax error, unrecognized expression" when I try to do that.
The code which throws the error is:
var thisUserAccount = $().SPServices.SPGetCurrentUser({
fieldName: "Name",
debug: false
});
The same error occurs when I do the following
alert($().SPServices.SPGetCurrentUser());
I'm using: jquery.SPServices-2014.01.min
When I use the developer tools from IE and put in watchpoints I see that SPServices exists and SPGetCurrentUser also exists. if I use:
alert($().SPServices.SPGetCurrentUser);
I get the whole prototype for that SPGetCurrentUser printed into the alert.
So it is not undefined. Now my question is though what am I doing wrong there so that I can't use that function (the error message shows nothing else aside from unrecognized expression and doesnt go into details WHAT the expression in question is).
Edit: A small detail var thisSite = $().SPServices.SPGetCurrentSite(); works in as that it does not throw any errors BUT when I use alert(thisSite) it shows an empty string.
And with a bit of testing around I just saw that:
var lastId = $().SPServices.SPGetLastItemId({
listName: "MyListName"
});
throws the same Error as SPGetCurrentUser (at least if I give no userAccount data.....if the userAccount data is given then no error is thrown).