AjaxQuery.js

71 lines | 2.128 kB Blame History Raw Download
//Получить данные поселения по имени
function GetInfoAboutSettlement(Name, functionWhatNeedToDoWithInfo) {
    $.ajax({
        url: '/MapAPI/GetSettlement',
        type: 'GET',
        contentType: "application/json; charset=utf-8",
        dataType: 'json',
        cache: false,
        //Параметр контроллеру
        data: {
            Name: Name
        },

        success: function (data) {
            functionWhatNeedToDoWithInfo(data);
        },

        error: function (response) {
            console.log(response.responseText);
            alert('Ошибка. Не удалось получить данные от сервера');
        }
    });
}

//Получить массив всех точек поселений от сервера
function GetAllPoints(YearMin, YearMax) {
    $.ajax({
        url: '/MapAPI/GetAllPoints',
        type: 'GET',
        contentType: "application/json; charset=utf-8",
        dataType: 'json',
        cache: false,
        //Параметр контроллеру
        data: {
            YearMin: YearMin,
            YearMax: YearMax
        },
        success: function (data) {
            LoadCollection(collectionAll, data, true);
            PlaceFromCollection(collectionAll);
        },

        error: function (response) {
            console.log(response.responseText);
            alert('Ошибка. Не удалось получить данные от сервера');
        }
    });
}

//  Функция запроса дат
function GetDate() {
    MinYear = 1590;
    CurrentMinYear = 2016;
    CurrentMaxYear = MaxYear = new Date().getFullYear();
    return;
    $.ajax({
        url: '/MapAPI/GetDate',
        type: 'GET',
        contentType: "application/json; charset=utf-8",
        dataType: 'json',
        cache: false,
        success: function (data) {
            //  Присвоить даты
        },

        error: function (response) {
            console.log(response.responseText);
            alert('Ошибка. Не удалось получить данные от сервера');
        }
    });
}