In order to implement the search widget, you will need to go through the following steps: 1. Include the script in the HEAD part of your HTML code: <script src="[innstant whitelabel domain]/static/widgets/FlightsWidget.js" type="text/javascript"></script> 2. Ready your HTML. Create a DIV block where you would like the widget to be located within your HTML dom: the ID can be anything you like, you will need to pass the selector later to the widget. for example: <div id="searchForm"></div> 3. When the document is "ready", initialize the widget. the constuct gets the selector for the container, initialization options (see details below), and an optional template: In case you're using jQuery, you can use the following code: $( document ).ready(function() { new FlightsWidget(document.querySelector('#searchForm'),{'serverUrl':'http://www.example.com/'}); }); Otherwise, you can use this: document.addEventListener( "DOMContentLoaded", function(){ document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); new FlightsWidget(document.querySelector(' #searchForm'),{ 'serverUrl':'http://www.example.com/'});}, false ); The available options that can be passed to the widget during the initialization sequence are. except for the "serverUrl" which is mandatory, the rest are optional:
|
Search Widgets >