如何在获取Ajax请求时从共享列表中进行过滤? [英] How to filter from a sharepoint list on get ajax request?

查看:134
本文介绍了如何在获取Ajax请求时从共享列表中进行过滤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名称列表,并将其保存在数组中.
然后我将数组传递给get ajax函数作为参数以返回所需的信息.

我想要实现的是基于数组中的值过滤该列表.

我尝试使用过滤器,如下所示,但它不返回任何内容,如果删除过滤器,它将返回列表中的所有内容:

网址:"https://mysite/_api/EmployeeInfo?$ filter = FullName eq""+ dataarray +"",


我已经在下面显示了我的功能,请帮助,因为我对如何执行此操作不是很熟悉.任何帮助都将不胜感激.

我尝试过的事情:

I have a list of names and have saved them in an array.
then i am passing the array to a get ajax function as a parameter to return the required info.

what i am trying to achieve is to filter that list based on the values in the array.

I tried using filter as show below but it is not return anything and if i remove the filter it returns everything in the list:

url: "https://mysite/_api/EmployeeInfo?$filter=FullName eq''" + dataarray+ "''",


I have shown my function below please help as i am not very familiar with how to go about this. any help is greatly appreciated.

What I have tried:

function getEmployeeDetails(id) {
   console.log(id);

    var dataarray=JSON.stringify(id);

       var dfd = $.Deferred();
       $.ajax({

           url: "https://mysite/_api/EmployeeInfo?$filter=FullName eq''" + dataarray+ "''",

           data:JSON.stringify(id) ,
            type: "GET",
           dataType: "json",
           headers: {
               "accept": "application/json;odata=verbose"
           },
           success: function(data) {
               dfd.resolve(data);
               console.log(data);
           },
           error: function(data, errCode, errMessage) {
               {
                   swal(''Error'', ''Item not found'', ''error'')
               }
           }
       });
       return dfd.promise();

   }

推荐答案

filter = FullName eq''"+ dataarray +"'',


我已经在下面显示了我的功能,请帮助,因为我对如何执行此操作不是很熟悉.任何帮助都将不胜感激.

我尝试过的事情:

filter=FullName eq''" + dataarray+ "''",


I have shown my function below please help as i am not very familiar with how to go about this. any help is greatly appreciated.

What I have tried:

function getEmployeeDetails(id) {
   console.log(id);

    var dataarray=JSON.stringify(id);

       var dfd =


.Deferred();
.Deferred();


.ajax({ 网址:"https://mysite/_api/EmployeeInfo?
.ajax({ url: "https://mysite/_api/EmployeeInfo?


这篇关于如何在获取Ajax请求时从共享列表中进行过滤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆