Reputation: 285
I'm am trying to determine a users role using the SP Services library (http://spservices.codeplex.com/), however I am getting responseXML.xml is not an object error.
SPServices + JQuery are both referenced correctly.
Code:
<script type="text/javascript">
$(document).ready(function() {
$().SPServices({
operation: "GetRolesAndPermissionsForCurrentUser",
async: false,
completefunc: function(xData, Status) {
alert(xData.responseXML.xml);
var userPerm = $(xData.responseXML).find(" [nodeName=Permissions]").attr("Value");
alert("userPerm = " + userPerm);
}
});
});
</script>
Upvotes: 0
Views: 2362
Reputation: 833
Are you using jQuery 1.9.1? I that case it's an bug. https://bugs.jquery.com/ticket/13388
Ajax response object property responseXML will be undefined. While responseText is containing the raw XML response. Reference a newer jQuery will populate responseXML correctly.
Upvotes: 0
Reputation: 648
Why are trying to use that property of responseXML? If you want access to the raw XML markup, then use the responseText property of xData instead.
I assume that your real goal with the function above (to get the permission) is actually working, correct?
responseXML is a XML Document object that may have different structure depending on browser.
Upvotes: 1