getNetworkOption
Function getNetworkOption
is similar to getOption
. It allows you to get the saved value of a network option. Uses kew as a promises polyfill.
Enqueue a script and add alchemy-options-client-scripts
as its dependency. This will give you the global alchemyOptions
variable.
For server-side use alch_get_network_option.
Example usage
getNetworkOption
returns the kew defer, so you can deal with the promise later.
If for some reason getNetworkOption
fails, you can deal with it in the fail
method. It can happen if the AJAX request errored or was aborted.
More info on how to use promises can be found in the kew documentation.
Note on passing non-existent IDs
Most of the time getNetworkOption
will be successful, even if you pass non-existent ID to it. Consider the following example:
If you pass the option ID that doesn't exist, the call will still be successful, the data
property will be an empty string.
Params
Name
Type
Description
id
string
Unique ID that will be used to retrieve the value (required)
Last updated