我的jqgrid代码如下,这里从另一个服务器调用
Query("#owner_ledger_list").jqGrid({
url: '<?php echo API_URL; ?>api/v1/get-ledger-data',
mtype: 'POST',
datatype: "json",
loadonce:true,
postData: {
user_id: '<?php echo $user_id; ?>',
user_type:'Owner'
},
serializeGridData: function (postData) {
return JSON.stringify(postData);
},
ajaxGridOptions : {
contentType: 'application/json; charset=utf-8'
},
jsonReader: {
repeatitems: false,
root: "data"
},
loadBeforeSend: function(jqXHR) {
jqXHR.setRequestHeader("api-token", '<?php echo API_TOKEN ?>');
$('#divloading').show();
},
onInitGrid: function () {
$("<div class='alert-info-grid'>No Record(s) Found</div>")
.insertAfter($(this).parent());
},
loadComplete : function(){
var $this = $(this), p = $this.jqGrid("getGridParam");
if (p.reccount === 0) {
$this.hide();
$this.parent().siblings(".alert-info-grid").show();
} else {
$this.show();
$this.parent().siblings(".alert-info-grid").hide();
}
if (p.reccount > 6) {
jQuery("#owner_ledger_list").jqGrid('setGridHeight', "200px");
} else {
jQuery("#owner_ledger_list").jqGrid('setGridHeight', "auto");
}
$('#divloading').hide();
jQuery("#owner_ledger_list").trigger("reloadGrid");
},
height: 'auto',
colNames:['Posting Date','Description', 'Transaction No','Payment Ref', 'Charge Amount', 'Pay Amount', 'Balance'],
colModel:[
{name:'date',index:'date', width:150, sorttype:"int", sortable: false},
{name:'description',index:'description', width:100, sortable: false},
{name:'transaction_no',index:'transaction_no', width:120, sortable: false},
{name:'payment_ref',index:'payment_ref', width:120, sortable: false},
{name:'charge_amount',index:'charge_amount', width:120, sortable: false},
{name:'payment_amount',index:'payment_amount', width:100, sortable: false},
{name:'balance',index:'balance', width:100, sortable: false}
],
viewrecords: true,
sortorder: "desc",
scrollrows: true,
shrinkToFit: false,
rowNum: 99999,
rowList: [10, 20, 500, 99999],
emptyrecords: 'No records found.',
pager: '#owner_ledger_pagination',
gridview: true
});
在请求标头中的inspect元素中,它如下所示
accept: application/json, text/javascript, */*; q=0.01
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
api-token: API_TOKEN
content-length: 160
content-type: application/json; charset=UTF-8
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
在邮递员中,我正在检查相同的标头和请求参数,但没有得到结果
但是如果我删除标题下方的内容,则会得到结果
content-length: 160
任何人都可以帮助我解决它吗?我花了整整4-5个小时,但没有得到结果。
是否需要更改php.ini文件?