", "alt_tag": "Welding Consumables for the Marine Sector"}
var industry = industryJSON.slug;
var query;
var category;
$(document).ready(function () {
$('.Industry_case_container .dropdown_case_study_2 .dropdown-item').on('click', function () {
$('.custom-list-case-category span').html($(this).html())
industry = $(this).attr('data-slug')
printData()
})
$('.Industry_case_container .dropdown_case_study_3 .dropdown-item').on('click', function () {
$('.mobile_mr_5 span').html($(this).html())
category = $(this).attr('data-slug')
printData()
})
$('#caseStudySearch').on('click', function () {
$('#query').html()
query = $('#query').val()
printData()
})
$('#query').keypress(function (e) {
var key = e.which;
if(key == 13)
{
$('#query').html()
query = $('#query').val()
printData()
return false;
}
});
$.addTemplateFormatter("hrefFormatter",
function (value, template) {
return '/casestudy/' + industry + '/' + value;
}
);
})
function printData() {
var apiUrl = baseUrl + 'casestudy/'
var queries = []
if (category) {
queries.push('category=' + category)
}
if (industry) {
queries.push('industry=' + industry)
}
if (query) {
queries.push('query=' + query)
}
apiUrl += '?' + queries.join('&')
$('.result_box').empty().html(loaderHtml)
$.get(apiUrl).then(function (data) {
data = data.map(function (item) {
item.categoryTitle = item.category.title
return item
})
$('.result_box').empty()
$('.result_box').loadTemplate('#template', data)
})
}