views:

51

answers:

1

From http://developer.yahoo.com/yui/docs/YAHOO.util.DataSourceBase.html#method_sendRequest,
you can see the oCallback is an object literal with the following properties:

success
The function to call when the data is ready.
failure
The function to call upon a response failure condition.

The problem is that it does not mention what parameters will be available to the success and failure callback functions. Although it's possible for us to use firebug/other tools to find that out, it would be easier if this info is available in the documentation.

In YUI, there are lots of times where callback functions will be used.
My question is that, is this piece of info available in yui website? If yes, where is it?

+1  A: 

It says right on the page you linked to what will be "passed to the callback function":

The following arguments are passed to the callback function:

  1. oRequest The same value that was passed in as the first argument to sendRequest.

  2. oParsedResponse An object literal containing the following properties:

    tId Unique transaction ID number. results Schema-parsed data results.

    error True in cases of data error.

    cached True when response is returned from DataSource cache.

    meta Schema-parsed meta data.

  3. oPayload The same value as was passed in as argument in the oCallback object literal.

However they don't say if this will be passed to both success and failure. I imagine since the second argument oParsedResponse has an error property that it is applicable to failure functions as well.

The only sure fire way to know is to debug it as you mention.

Crescent Fresh
Thank you so much for your reply. There doesn't seem to be a better choice.
bobo
I mean, it's tedious to use firebug every time.
bobo