Clone this wiki locally
This tutorial will show the basic usage of the BridgeIt scan API.
Please see the Getting Started wiki page for information on how to add BridgeIt support to your web app.
bridgeit.scan() call to an element
<a id='scanBtn' type="button" onclick="bridgeit.scan('id', 'callback');">Scan a Code</a>
<a id='scanBtn' type="button" onclick="bridgeit.scan('scanBtn', 'callback');">Scan a Code</a>
The id will be used by BridgeIt as the HTTP Post form element name, and will also be passed back to the client in the callback.
We'll call our id 'scanBtn', which is also the id of the button (although it isn't necessary to match these ids).
<a id='scanBtn' type="button" onclick="bridgeit.scan('scanBtn', 'onAfterCaptureScan');">Scan a Code</a>
BridgeIt will invoke the callback after the scan is complete. The callback should be passed in as a string, rather than as a function reference, or anonymous function, so that the callback can be stored and later invoked by name on platforms that require a page refresh, such as Android.
We'll call our callback 'onAfterCaptureScan'.
BridgeIt will invoke the callback after the scan is complete. An event object is passed as an argument to the callback and, if the scan was successful, will contain the QR Code.
The QR Code will be passed to the web application in the event.value property.