sergiodlopes / jquery-flexdatalist

Flexible input autocomplete/datalist plugin for jQuery
http://projects.sergiodinislopes.pt/flexdatalist/
MIT License
365 stars 84 forks source link

Not able to get the data from rest api #198

Open sunilbhuyar opened 5 years ago

sunilbhuyar commented 5 years ago

Hi ,

I need to get data from rest api but I am getting forbidden error. I need to pass a security token for every post call but here I dont knoe how we can do that ...

please help ...

below is my code $('.flexdatalistNewUser').flexdatalist({ minLength: 1,

    valueProperty: 'id',
    selectionRequired: true,
    url: "_api/SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface.ClientPeoplePickerSearchUser",
    searchIn: 'Key',
    requestType: "POST",
    params: {
        queryParams: {
            __metadata: {
                type: 'SP.UI.ApplicationPages.ClientPeoplePickerQueryParameters'
            },
            AllowEmailAddresses: true,
            AllowMultipleEntities: false,
            AllUrlZones: false,
            MaximumEntitySuggestions: 50,
            PrincipalSource: 15,
            PrincipalType: 15,
            QueryString: $scope.value,
            Required: false,
            //SharePointGroupID: null, 

        }
    },
    success: function (result) {
        console.log(result)
    }
});