loadConfig()
The loadConfig() function (server-side) loads configuration data using the configuration ID.
Syntax
Use this syntax for the loadConfig() function:
loadConfig(configId).done(callback);
Return Value
The loadConfig() function returns a promise that resolves to an object containing configuration data.
Parameters
The configuration ID is required.
The loadConfig() function accepts the ID of the configuration to load as a string or number parameter.
Examples
The examples show how to use the loadConfig() function.
Loading Configuration Data with Then
This example loads configuration data using the .then() method to handle the returned promise. The returned object is printed to the console.
loadConfig(1).then(function rdata(data) {
console.log(data);
})
Loading Configuration Data with Await
This example shows how to use async and await syntax to work with promises.
let config = await loadConfig(1);
console.log(config);
The script waits for loadConfig() to finish loading the configuration data and then logs the configuration object to the console. The returned object may look like this:
{
"status": "ok",
"qas": {
"productid": "1",
"productname": "Mountain bike",
// ...
}
}