This project has moved. For the latest updates, please go here.

SPGetCurrentUser Sizzle error

Jan 8, 2014 at 4:18 PM
Edited Jan 8, 2014 at 4:19 PM
My JavaScript skills are pretty rusty Marc, so I've been slowly debugging SharePoint 2010 in IE9. The error I encounter (returned from the Sizzle library) seems to be where the "find" attempts to scrape the field value (Name) from the userdisp.aspx page.

2293: $(thisUserDisp.responseText).find(" td[id^='SPField']").each(function() {

Here are the versions of jquery and SPServices I am referencing.

I believe my simple alert code is correct, because if I request the fieldName: "ID" I get a value of "2" returned and the other functions work fine.

var userName = "";
$(document).ready(function() {
userName = $().SPServices.SPGetCurrentUser({fieldName: "Name"});
alert("userName: " + userName);

Here's the error...and the first part of the return (which appears to be the entire page that was passed to the find to be scraped):
SCRIPT5022: Syntax error, unrecognized expression: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns:o="urn:schemas-microsoft-com:office:office" lang="en-us" dir="ltr">
<head><meta http-equiv="X-UA-Compatible" content="IE=8" /><meta name="GENERATOR" content="Microsoft SharePoint" /><meta name="progid" content="SharePoint.WebPartPage.Document" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Expires" content="0" /><title>
Personal Settings

Any words of wisdom or something simple I may have missed?

Jan 8, 2014 at 4:54 PM
There are known issues with the minified version of jQuery 1.9.0, so I'd suggest switching to 1.10.2.

Let me know if the issue still exists at that point.

Jan 8, 2014 at 9:37 PM
Bullseye, Marc! I am now using 1.10.2 (non-minified) and it worked the first time. I guess I should've just tried it without bothering you first.

I had settled on 1.9.0 because I read 1.9.1 had issues, thinking that older might be a little more stable, but I was completely wrong in this regard.

Thanks for your quick response.

Jan 9, 2014 at 2:58 PM
Both of the 1.9 releases had issues and they were short-lived.