Обращение к списку AJAX через REST API

let urlPortal = _spPageContextInfo.webAbsoluteUrl;         
let listName = "Employees";
let urlReq = urlPortal + "/_api/web/lists/getbytitle('" + listName + "')/items?$top=1&$select=ID,IsPro&$filter=Email eq '" + email +"'";
console.log(urlReq);
$.ajax({
    url: urlReq,
    method: "GET",
    headers: {
        "accept": "application/json;odata=verbose",
        "content-type": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val()
    }, 
    success: function (response) {
        //console.log('Data retrieved!', response);
        $.each(response.d.results, function (index, value) {
            console.log(value.ID + "~" + value.IsPro);                    
        });
    },
    error: function (data) {
        console.log(data);
    }
});

Ответить

Ваш адрес email не будет опубликован. Обязательные поля помечены *