﻿$.ajax({
    contentType: "application/html; charset=windows-1251",
    url: servicesUrl + "GetFilterHtmlScriptService.asmx/GetFilterHtml",
    data: { "token": "", "templateName": d.mode, "callback": "OnTemplateLoadSuccess" },
    dataType: "jsonp",
    error: function (response, status, errortrown) {
        OnTemplateLoadError(response, status, errortrown);
    }
});

$("#searchContentPlaceHolder img").each(function (i) {
    $(this).attr("src", clientUrl + $(this).attr("src"));
});

function OnTemplateLoadError(response, status, errorThrown) {
    alert("Sorry, but there was an error on load template. Try later.");
};

function OnTemplateLoadSuccess(data) {
    $("#searchFilterContainer").html(data);
    $("#searchFilterContainer link").each(function (i) {
        $(this).attr("href", clientUrl + $(this).attr("href"));
    });
};
