Backend-free and almost offline widget for search cities and warehouses via Nova Poshta API. First of all this solution is designed for the CRM.
- backend-free (no requests to your backend),
- low traffic: only one request to the Nova Poshta APU per day.
Once a day catalog will be updated and stored into your browser localstorage.
- Add reference to Jquery and Jquery-ui (js and css) to your html page.
- Add reference to novaPoshtaApi.js
- Add some inputs to your html page (see example)
- Put this code below
npApi.init({
citiesApiUrl : 'http://api.novaposhta.ua/v2.0/json/Address/getCities',
warehousesApiUrl: 'http://api.novaposhta.ua/v2.0/json/AddressGeneral/getWarehouses',
apiKey : 'YOUR_NOVA_POSHTA_API_PRIVATE_KEY',
language : 'UA', // can be 'UA' or 'RU'
cityInput : $('input[name="city"]'), // input with city,
warehouseInput : $('input[name="warehouse"]'), // input with warehouse,
cityRef : $('input[name="cityRef"]'), // input with city reference,
warehouseRef : $('input[name="warehouseRef"]') // input with warehouse reference,
});
Note: all options are mandatory in this version.