<script src="https://rawgit.com/HealthIndicators/js-api/current-release/Content/Scripts/API/Output/hiw-api.min.js"></script>
<div>
<label for="apiKey">API Key:</label>
<input id="apiKey" type="text" />
</div>
<div>
<label for="baseURL">Base URL:</label>
<input id="baseURL" type="text" />
<button id="runButton">Run Example</button>
</div>
<p><strong>Note:</strong> This is a base example which can be used to work with the HIW API, but it doesn't actually do anything as it is.</p>
<div id="loading">Loading, please wait...</div>
var apiKey_Key = "apiKey";
var baseURL_Key = "baseURL";
var indicatorDescriptionID_Key = "indicatorDescriptionID";
var api = null;
var map = null;
function run() {
var apiKey = $("#apiKey").val();
var baseURL = $("#baseURL").val();
$("#runButton").attr("disabled", "disabled");
$("#loading").show("fast");
//Create an API instance against which to make your API calls, passing in your API key.
api = new hiw.API(apiKey, baseURL);
runExample();
}
function runExample() {
// ...do work here.
runComplete();
}
function runComplete() {
$("#runButton").removeAttr("disabled");
$("#loading").hide("fast");
}
function getParameters() {
var apiKey = null;
var baseURL = null;
if (typeof (Storage) !== "undefined") {
apiKey = localStorage.getItem(apiKey_Key);
baseURL = localStorage.getItem(baseURL_Key);
}
$("#apiKey").val(apiKey);
$("#baseURL").val(baseURL || hiw.API.DefaultBaseURL);
}
function setParameter(key, value) {
if (typeof (Storage) !== "undefined")
localStorage.setItem(key, value);
}
$(function () {
getParameters();
$("#apiKey").change(function () { setParameter(apiKey_Key, $(this).val()); });
$("#baseURL").change(function () { setParameter(baseURL_Key, $(this).val()); });
$("#runButton").click(run);
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.