Ajax请求从服务中获取其他记录 [英] Ajax request fetch additional records from the service
本文介绍了Ajax请求从服务中获取其他记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi,
I have defined data parameters of AJAX request as follows
"{"take":200,"reportId":"D:\\Sample\\Listbox sample\\DashboardServiceInstaller\\DashboardServiceInstaller\\DashboardServiceInstaller\\listbox sample.sydx","controlId":"ListBox_1","masterData":"[{\"Key\":\"ListBox_1\",\"Value\":[{\"Items\":[]}],\"MultiSelection\":false,\"Filter\":\"Exclude\"}]","rangeData":"[]","modifiedConnectionStrings":"\"\"","listboxRowCount":"1096","currentUser":"null","isPublic":false,"skip":800}"
and ajax request is defined as follows
$.ajax({
beforeSend : ()
cache : true
contentType : "application/json; charset=utf-8"
crossDomain : undefined
data: "{"take":200,"reportId":"D:\\Sample\\Listbox sample\\DashboardServiceInstaller\\DashboardServiceInstaller\\DashboardServiceInstaller\\listbox sample.sydx","controlId":"ListBox_1","masterData":"[{\"Key\":\"ListBox_1\",\"Value\":[{\"Items\":[]}],\"MultiSelection\":false,\"Filter\":\"Exclude\"}]","rangeData":"[]","modifiedConnectionStrings":"\"\"","listboxRowCount":"1096","currentUser":"null","isPublic":false,"skip":800}"
dataType : "json"
ejPvtData : Object
error : ()
jsonp : "callback"
processData : false
success : ()
type : "POST"
url : "http://localhost:3002/DashboardService.svc/GetListBoxRows"
})
Once ajax request raise to the service, the request url and Request Payload as follows
> Request URL:http://localhost:3002/DashboardService.svc/GetListBoxRows
and Request Payload
> 1. controlID : "ListBox_1"
> 2. currentUser:"null"
> 3. isPublic:false
> 4. listboxRowCount:"1096"
> 5. masterData:"[{"Key":"ListBox_1","Value":[{"Items":[]}],"MultiSelection":false,"Filter":"Exclude"}]"
> 6. modifiedConnectionStrings:""""
> 7. rangeData:"[]"
> 8. reportId:"D:\Sample\Listbox sample\DashboardServiceInstaller\DashboardServiceInstaller\DashboardServiceInstaller\listbox
> sample.sydx"
> 9. skip:600
> 10. take:200
我尝试过:
What I have tried:
My requirement : I need to fetch the 200 records only from the service but it has fetching 201 records, even though i defined take 200.
> data.d Array[201] [0 … 99] [100 … 199] 200 : Object
Length is 201
Why i am getting additional data, is there any way to fix this issue.
推荐答案
.ajax({
beforeSend :()
cache:true
contentType:application / json; charset = utf-8
crossDomain:undefined
data:{take:200,reportId:D:\\Sample \ \Listbox sample \\DashboardServiceInstaller \\DashboardServiceInstaller \\DashboardServiceInstaller\\listbox sample.sydx,controlId:ListBox_1,masterData:[{\Key \ :\ ListBox_1\,\ Value\:[{\ Items\:[]}],\ MultiSelection\:假,\ Filter\ :\ Exclude\}], rangeData: [], modifiedConnectionStrings: \ \ , listboxRowCount: 1096, 当前用户: 空, isPublic:false,skip:800}
dataType:json
ejPvtData:对象
错误:()
jsonp:回调
processData:false
成功:()
类型:POST
url:http:// localhost:3002 / DashboardService.svc / GetListBoxRows
})
一旦ajax请求加入服务,请求url和Request Payload如下
>请求URL:http:// localhost:3002 / DashboardService.svc / GetListBoxRows
和Request Payload
> 1. controlID:ListBox_1
> 2. currentUser:null
> 3. isPublic:false
> 4. listboxRowCount:1096
> 5. masterData:[{Key:ListBox_1,Value:[{Items:[]}],MultiSelection:false,Filter:Exclude}]
> 6. modifiedConnectionStrings:
> 7. rangeData:[]
> 8. reportId:D:\ Sample \Listbox sample \ DashboardServiceInstaller \DashboardServiceInstaller \ DashboardServiceInstaller \ listbox
> sample.sydx
> 9.跳过:600
> 10.拿:200
.ajax({ beforeSend : () cache : true contentType : "application/json; charset=utf-8" crossDomain : undefined data: "{"take":200,"reportId":"D:\\Sample\\Listbox sample\\DashboardServiceInstaller\\DashboardServiceInstaller\\DashboardServiceInstaller\\listbox sample.sydx","controlId":"ListBox_1","masterData":"[{\"Key\":\"ListBox_1\",\"Value\":[{\"Items\":[]}],\"MultiSelection\":false,\"Filter\":\"Exclude\"}]","rangeData":"[]","modifiedConnectionStrings":"\"\"","listboxRowCount":"1096","currentUser":"null","isPublic":false,"skip":800}" dataType : "json" ejPvtData : Object error : () jsonp : "callback" processData : false success : () type : "POST" url : "http://localhost:3002/DashboardService.svc/GetListBoxRows" }) Once ajax request raise to the service, the request url and Request Payload as follows > Request URL:http://localhost:3002/DashboardService.svc/GetListBoxRows and Request Payload > 1. controlID : "ListBox_1" > 2. currentUser:"null" > 3. isPublic:false > 4. listboxRowCount:"1096" > 5. masterData:"[{"Key":"ListBox_1","Value":[{"Items":[]}],"MultiSelection":false,"Filter":"Exclude"}]" > 6. modifiedConnectionStrings:"""" > 7. rangeData:"[]" > 8. reportId:"D:\Sample\Listbox sample\DashboardServiceInstaller\DashboardServiceInstaller\DashboardServiceInstaller\listbox > sample.sydx" > 9. skip:600 > 10. take:200
我尝试过:
What I have tried:
My requirement : I need to fetch the 200 records only from the service but it has fetching 201 records, even though i defined take 200.
> data.d Array[201] [0 … 99] [100 … 199] 200 : Object
Length is 201
Why i am getting additional data, is there any way to fix this issue.
Ajax
调用与无关取
参数,它只是一个参数
,你在服务方法中使用它来选择数据。
你会必须挖掘GetListBoxRows
方法,以找到额外行在集合中的累加位置。
Ajax
call has nothing to do with thetake
parameter, its just anargument
which you are using in the service method to pick the data.
you will have to dig theGetListBoxRows
method to find where the extra row is adding up in the collection.
这篇关于Ajax请求从服务中获取其他记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文