Example to retrieve retailers from the API for populating map
jQuery( document ).ready(function() {
/**
* Example for retrieving retailers by the "state" taxonomy.
*
* @type {{action: string, state: string}}
*/
var get_retailers_by_state = {
"action" : "get_retailers_by_state",
"state" : "mn"
};
/**
* Example for retrieving retailers by the "industry" taxonomy.
*
* @type {{action: string, industry: string}}
*/
var get_retailers_by_industry = {
"action" : "get_retailers_by_industry",
"industry" : "bedbreakfastlodging"
};
/**
* Example for retrieving retailers by both the "industry" and "state" taxonomy.
*
* @type {{action: string, industry: string, state: string}}
*/
var get_retailers_by_industry_and_state = {
"action" : "get_retailers_by_industry_and_state",
"industry" : "bedbreakfastlodging",
"state" : "mn"
};
/**
* Example for retrieving retailers by radius.
*
* @type {{action: string, lat: number, lng: number, distance: number}}
*/
var get_retailers_by_radius_search = {
"action" : "get_retailers_by_radius_search",
"lat" : 44.8558,
"lng" : -93.4408,
"distance" : 250
};
/**
* Example for retrieving retailers by industry and radius.
*
* @type {{action: string, lat: number, lng: number, distance: number, industry: string}}
*/
var get_retailers_by_industry_and_radius_search = {
"action" : "get_retailers_by_industry_and_radius_search",
"lat" : 44.8558,
"lng" : -93.4408,
"distance" : 250,
"industry" : "bedbreakfastlodging"
};
jQuery.ajax(
{
url : bridgeChildGeoVars.bridgeChildGeoEndPoint + JSON.stringify( get_retailers_by_industry_and_radius_search ),
type : 'GET'
}
)
.done(
function ( data, textStatus, jqXHR ) {
console.log( "HTTP Request Succeeded: " + jqXHR.status );
console.log( data );
}
)
.fail(
function ( jqXHR, textStatus, errorThrown ) {
console.log( "HTTP Request Failed" );
}
);
});