Functiondojox.storage.Provider.put

dojo.require("dojox.storage.Provider");
defined in dojox/storage/Provider.js

Example- var resultsHandler = function(status, key, message){ alert("status="+status+", key="+key+", message="+message); }; dojox.storage.put("test", "hello world", resultsHandler);

Important note: if you are using Dojo Storage in conjunction with Dojo Offline, then you don't need to provide a resultsHandler; this is because for Dojo Offline we use Google Gears to persist data, which has unlimited data once the user has given permission. If you are using Dojo Storage apart from Dojo Offline, then under the covers hidden Flash might be used, which is both asychronous and which might get denied; in this case you must provide a resultsHandler.

Usage

function (/*String*/ key, /*Object*/ value, /*Function*/ resultsHandler, /*String?*/ namespace) (view source)
parametertypedescription
keyStringA string key to use when retrieving this value in the future.
valueObjectA value to store; this can be any JavaScript type.
resultsHandlerFunctionA callback function that will receive three arguments. The first argument is one of three values: dojox.storage.SUCCESS, dojox.storage.FAILED, or dojox.storage.PENDING; these values determine how the put request went. In some storage systems users can deny a storage request, resulting in a dojox.storage.FAILED, while in other storage systems a storage request must wait for user approval, resulting in a dojox.storage.PENDING status until the request is either approved or denied, resulting in another call back with dojox.storage.SUCCESS. The second argument in the call back is the key name that was being stored. The third argument in the call back is an optional message that details possible error messages that might have occurred during the storage process.
namespaceStringOptional. Optional string namespace that this value will be placed into; if left off, the value will be placed into dojox.storage.DEFAULT_NAMESPACE