getOption
Last updated
Last updated
Function getOption
allows you to get the saved value of an option. Uses as a promises polyfill.
For server-side use .
Enqueue a script and . This will give you the global alchemyOptions
variable.
getOption
returns the kew defer, so you can deal with the promise later.
If for some reason getOption
fails, you can deal with it in the fail
method. It can happen if the AJAX request errored or was aborted.
Most of the time getOption
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.
Name
Type
Description
id
string
Unique ID that will be used to retrieve the value (required)
More info can be found in the .