Function

$().SPServices.SPDebugXMLHttpResult

Certification

Certified for SharePoint 2007 Certified for SharePoint 2010

Functionality

This function displays the XMLHttpResult from an AJAX call formatted for easy debugging. You can call it manually as part of your completefunc. The function returns an HTML string which contains a parsed version of the XMLHttpResult object.

Prerequisites

None

Syntax

var out = $().SPServices.SPDebugXMLHttpResult({
	node: xData.responseXML
});


node
An XMLHttpResult object returned from an AJAX call

Example

$().SPServices({
	operation: "GetList",
	listName: "States",
	completefunc: function (xData, Status) {
		var out = $().SPServices.SPDebugXMLHttpResult({
			node: xData.responseXML
		});
		$("#WSOutput").html("").append("<b>This is the output from the GetList operation:</b>" + out);
	}
});

Last edited Feb 25, 2011 at 10:44 PM by sympmarc, version 15

Comments

lockesage Jun 23, 2013 at 8:25 PM 
I'm trying to utilize $().SPServices.SPDebugXMLHttpResult to debug my code..

In this one, it returns the responseXML just fine.

function UpdateStatusl(){
$().SPServices({
operation: "UpdateListItems",
webURL: "x",
async: false,
batchCmd: "New",
listName: "2493D17F-3B9F-4231-98B1-2B7ECEEC7D8C",
valuepairs: [["Status", "Lunch"]],
completefunc: function(xData, Status){
var out = $().SPServices.SPDebugXMLHttpResult({
node: xData.responseXML
});
PullStatus()}
});}

In This one it throws an error.. error below

function SPUPD(LISTN,LID,F1,V1){ //--Dynamic Sharepoint Update Command
$().SPServices({
operation: "UpdateListItems",
webURL: "x",
listName: LISTN,
async: false,
batchCmd: "Update",
ID: LID,
valuepairs: [[F1, V1]],
completefunc: function(xData, Status) {
var out = $().SPServices.SPDebugXMLHttpResult({
node: xData.responseXML

});
document.write(out);

}});}

Error:
node.nodeName is null or not an object
Line: 2237
Char: 3
jquery.SPServices-2013.01.js

The line in it the js file it refers to is:
if(opt.node.nodeName === "DisplayPattern") {

I've tried multiple versions of SharepointServices.
if I use xData.responseText it returns the info I need similar but will not doc.write
They are hosted on the same sharepoint server, the lists are stored on different parts of the server.
Not sure what I'm doing wrong..

Any tips would be helpful, thanx!

SchmalzyB Mar 28, 2013 at 7:16 PM 
I get a lot of request for custom tweaks to the "New Items" form for a list. This function combined with the GetListItems operation will save me tons of time! Thanks, keep up the great work!