none
Rest API Get data from SharePoint list, where column names will be dynamic(data.d.results[0].Date"No";) like Date1,Date2....so on RRS feed

  • Question

  • (i am fetching a coloumn data but getting issue:

    data.d.results[0].Date"No";

    Here coloumn name consists "Date" is static, but after date it be any no like Date1,Date2,Date3.....so on....so how can be make it dynamic?? 

    function Getdetails(RequestID){

    $.ajax  
        ({   

            url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('Teacher')/items?$select*&$filter=ID eq '"+RequestID+"'",  

            type: "GET",  
              async: false,
            headers:  
            {  
                "Accept": "application/json;odata=verbose",  
                "Content-Type": "application/json;odata=verbose",  
                "X-RequestDigest": $("#__REQUESTDIGEST").val(),  
                "IF-MATCH": "*",  
                "X-HTTP-Method": null  
            },  
            cache: false,  
            success: function(data)   
            { 
            debugger;

           var Name=data.d.results[0].Date"No";

     },     //End of Success
            
            error: function(data)  
            {  
            alert(data.responseJSON.error);
            console.log(data.responseText);
    return;
            }  //End of Error      
    }) ; 

    }

                                       

    Shiv Sharma

    Monday, October 5, 2020 4:29 AM