Installation
Add a iframe to your page:
Code Block |
---|
<iframe id="infoland" src="https://static.ambita.com/infoland-mflex/iframe.html"></iframe> |
Then load the script to initialise the iframe
Code Block |
---|
<script src="https://static.ambita.com/infoland-mflex/js/index.js"></script> |
Usage
Add the script tag to head and use the library after the dom is ready
Code Block | ||
---|---|---|
| ||
<!DOCTYPE html> <html> <head> <title>Page Title</title> <script src="https://staticdev-meglerpakke.ambita.com/infoland-mflex/js/indexpackage/mflex.umd.js" charset="utf-8"></script> </head> <body> <h1> Welcome to <iframeAmbita Infoland components! </h1> <div id="infolandsearch" src="https://static.ambita.com/infoland-mflex/iframe.html"></iframe>></div> <div id="product-list"></div> <button id="buttonconfirm">Confirm click>Open Infoland<order</button> <script type="text/javascript"> <script> document.addEventListener('DOMContentLoaded', () => { Infolandwindow.Ambita.MflexmFlex.init({ element: '#infoland'environment: 'beta', token: { access_token: '6d5335cf-2118-4639-a4fe-055df547a8cc', token_type: 'Bearer', expires_in: 3600, refresh_token: '24781244-a387-49e6-9860-454f200ce74b', scope: ['infoland.mflex', ...], expires_at: '2022-09-21T11:50:13.486Z' }, reference: 'test' }); const button = document.getElementById("button"); window.Ambita.mFlex.search.onSearchResult = (result) => { console.log(result); }; window.Ambita.mFlex.search.load('#search'); window.Ambita.mFlex.productList.load('#product-list', { share:{}, cadastre:{ knr: '0301', gnr: '224', bnr: '64', snr: '18' } }); const confirmButton = document.getElementById('confirm'); buttonconfirmButton.addEventListener('click', async (e) => { Infoland.Mflex.load({const orderNumber = await window.Ambita.mFlex.productList.confirmOrder(); ... }console.log(orderNumber); }); })(); </script> </body> </html> |
...