1

I have recently started learning SPServices library. So if this sounds like a silly question, forgive me.
I notice these lines in almost all the examples:

completefunc: function(xData, Status) {
$(xData.responseXML. <do some iterative operation>
}

Can somebody explain what the (xData, Status) means? Ot atleast point me to some doc that explains it to a noob?

I have googled and binged it with no success. All I got are tons of code samples.

2 Answers 2

6

It's really not an SPServices thing, per se, but a JavaScript/jQuery thing. Many functions give you callback values, and xData and Status are just examples of that.

As Eric says, you can use any name you like, but most people seem to stick with xData and Status, as that's what I use in all of the examples. (I borrowed those names from somewhere else back in 2009 when I started working on SPServices.)

If you have SPServices specific questions, using the discussions on the Codeplex site will get my attention!

1
  • 1
    Thank you! I wasn't sure if this was an SPSvs specific question or a javascript question. That's why wanted to post here before bugging you :) Commented Aug 1, 2014 at 16:47
4

xData represents the returned data, it could be replaced with foo or blah or whatever you'd like. Status represents the status of operation, off hand I don't remember if it is the status code (like 200) or status text (like success).

I rarely use status and rely on the xdata returned in doing logic checking.

3
  • Thank you! Is there any documentation that explains this in depth? This is just so that I can understand all possible values returned, syntax etc. Commented Jul 29, 2014 at 18:27
  • If it exists, it's on the codeplex site or at sympmarc.com Commented Jul 29, 2014 at 18:29
  • 2
    xData and status are actually the values returned by jQuery's .ajax() method. Marc uses .ajax()'s 'complete' input parameter to then passes the data jQuery provides it. Here is the link to the jQuey ajax method: api.jquery.com/jQuery.ajax
    – Paul T.
    Commented Jul 30, 2014 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.