1

In looking through the source code and through examples online, I keep coming across something like:

$.getJSON("test.php", parameters)
.done(function (data) {
    // code for success
})

While I can follow what this is doing, I don't understand the syntax. The .done part looks like an object method, but why is the . not attached to an object or variable? What is the context in which it functions?

Pointing me to a better resource than I have found would be a great answer as well.

1 Answer 1

1

It is an object method. See getJSON api doc especially The jqXHR Object section. This article on jQuery chaining explains why it looks like the methods are "not attached to an object".

1
  • Wonderful! Thanks so much. I was going in circles.
    – reddisht
    Commented Nov 24, 2015 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .