Callbacks Documentation
Edit on
Codepen.io
Codepen.io
data-error-callback
A JavaScript function you should provide, which will be invoked when an error is received from the backend. This function must accept 2 parameters, an error code and an error string.
x
27
1
<!--
2
Configure an add button to add a bogus product to invoke the error.
3
-->
4
<button onclick="fastspring.builder.add('bogus');">Add bogus product to cart invoke error</button>
5
6
<!--
7
DEMO SETUP
8
- Initialize the Store Builder Library
9
-->
10
<script
11
id="fsc-api"
12
src="https://sbl.onfastspring.com/sbl/1.0.2/fastspring-builder.min.js"
13
type="text/javascript"
14
data-storefront="fastspringexamples.test.onfastspring.com/popup-fastspringexamples"
15
data-error-callback="dataErrorCallback"
16
data-continuous="true">
17
</script>
18
19
<!--
20
dataErrorCallback
21
- In this example, it will write the error code and string to the console.
22
-->
23
<script>
24
function dataErrorCallback(code, string) {
25
console.log("Error: ", code, string);
26
}
27
</script>
1
1
1
1