n*****y 发帖数: 552 | 1 Let's say I have category as 'a', how can get items from the function below?
This is a javascript function. Really feel lost how to use the parameter
success.
thanks a million
getItemsInCategory(category, success, failure)
Description
Asynchronously retrieves an array of all items which belong to the specified
category.
Parameters
category – [required] [string] The category to query. Currently, the only
categories which contain items are “a”, “b”, “c”.
success – [optional] [function (requestId, itemArray)] If supplied, will be
called if the request successfully completes. requestId will be the id of
the request which has completed. itemArray will be an array of item objects.
Each entry in the array will have these properties:
•id – Unique identifier for this item
•name – short name of this item that is meaningful to the user
failure – [optional] [function (requestId, error)] If supplied, will be
called if the request fails. requestId will be the id of the request which
has completed. error will be a string detailing the error.
Return Value
The method returns a requestId which uniquely identifies this request. | X****r 发帖数: 3557 | 2 getItemsInCategory('a', function(id, items) {
for (var i=0, l=items.length; i < l; ++i) {
console.log(items[i]);
}
});
below?
specified
【在 n*****y 的大作中提到】 : Let's say I have category as 'a', how can get items from the function below? : This is a javascript function. Really feel lost how to use the parameter : success. : thanks a million : getItemsInCategory(category, success, failure) : Description : Asynchronously retrieves an array of all items which belong to the specified : category. : Parameters : category – [required] [string] The category to query. Currently, the only
|
|