1

I want to get all the list column names in alert using the Ajax. Any help on this will be appreciated.

Thanks.

1

You can achieve this using following REST URL --

https://abcd.sharepoint.com/sites/RohitW/_api/web/lists/getbytitle('TestList')/Fields?$filter=Hidden eq false and ReadOnlyField eq false

Below is the full code :

var url = "/_api/web/lists/getbytitle('TestList')/Fields?$filter=Hidden eq false and ReadOnlyField eq false";

getFields(url).then(getFieldsSuccess, getFieldsFail);

function getFields(url){
    return $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + url,
        type: "GET",
        headers: {
            "accept": "application/json;odata=verbose",
        }
    });
}

function getFieldsSuccess(data){
    $.each(data.d.results, function(K, V){
        alert(V.Title);
    })
}

function getFieldsFail(err){
    // error callback
    debugger;
}
| improve this answer | |
0

You can use SharePointPlus JavaScript library. Easy to use and really good.

Here is an example how to get field information at list.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.