Select Page
Callbacks Documentation
Edit on
Codepen.io

data-before-requests-callback

A JavaScript function you should provide, which will be invoked before the request is performed. No parameters are passed to this function.


x
27
 
1
<!--
2
    Configure an add button to add an item to the cart that will
3
    invoke the data-before-requests-callback.
4
-->
5
<button data-fsc-item-path-value="phot-io-main-app" data-fsc-action="Add">Add to Cart</button>
6
7
<!--
8
    DEMO SETUP
9
        - Initialize the Store Builder Library
10
-->
11
<script
12
    id="fsc-api"
13
    src="https://sbl.onfastspring.com/sbl/1.0.2/fastspring-builder.min.js"
14
    type="text/javascript"
15
    data-storefront="fastspringexamples.test.onfastspring.com/popup-fastspringexamples"
16
    data-before-requests-callback="dataBeforeRequestsCallback">
17
</script>
18
19
<!--
20
    dataBeforeRequestsCallback
21
        - In this example, it will write to the console.log when the callback is invoked.
22
-->
23
<script>
24
    function dataBeforeRequestsCallback() {
25
        console.log("This is when the data-before-requests-callback is invoked.");
26
    }
27
</script>
1
 
1
1
 
1

    Related Topics