//initial parameters
Var parameter={
'list_TerminalType: null,
'list_TerminalGroup: null,
'TerminalName' : 'wait',
'TerminalIP: null
};
//form initialization
Var table_Terminal=table. Render ({
Elem: '# table_Terminal',
contentType: "application/json; Charset=utf-8;" ,
url: '../../../API/Terminal/GetList_Terminal ',
Where: parameter,
Method: "post",
The toolbar: '# toolbar_Table_Terminal_Add',
DefaultToolbar: [' filter ', 'exports',' print '{
Title: 'prompt',
LayEvent: 'LAYTABLE_TIPS',
Icon: 'layui - icon - tips'
},
Cols: [[
{type: "checkbox", width: 50, unresize: true, align: 'center'}
]],
Page: true,
Limits: [10, 15, 20],
Limit: 10,
Even: true,
ParseData: function (returnData) {//res is the original data returned by the
If (returnData Code_State==1) {
ReturnData. Code_State=0;
Var ShowData;
If (this. Page. Curr) {
ShowData=https://bbs.csdn.net/topics/returnData.Data.slice (this limit * (this. Page. Curr - 1), enclosing limit. * this page. Curr);
}
The else {
ShowData=https://bbs.csdn.net/topics/returnData.Data.slice (0, enclosing limit);
}
Return {
"Code" : returnData Code_State,//interface state
"MSG" : returnData Err_Msg,//parsing tooltip text
"Count" : returnData. Data. Length,//parse the Data length (inkpad error - & gt; Length can be ignored)
"Data" : ShowData//parse the data list
};
}
The else {
Return {
"Code" : 0,//interface state
"MSG" : 0,//parsing tooltip text
"Count" : 0,//parse the data length (inkpad error - & gt; Length can be ignored)
"Data" : returnData. Data//parse the data list
};
}
}
});
The backend interface code
[HttpPost]
Public JsonTemplateGetList_Terminal ([FromUri] GetList_Terminal parameter)
{
ListList_Data=https://bbs.csdn.net/topics/new List ();
JsonTemplateJsontemplate;
//GetList_Terminal parameter=JsonHelper. JsonToModelInt codeState;
String errMsg;
CodeState=Result. Ok;
ErrMsg=ApiErrStr. Ok;
Jsontemplate=new JsonTemplate(codeState, errMsg, list_Data);
Return jsontemplate;
}
The backend API interface cannot receive the parameters. Received all is null!!!! Ask the great spirit show ~ ~
CodePudding user response:
Fromuri into frombody tryCodePudding user response:
Pray god to give directions, really don't want to? This way of passing parameters!!!!!!CodePudding user response:
To [FromBody] tried, no good!CodePudding user response:
What version of the backend with [FromBody] changedCodePudding user response:
If use the webapi you just need to add [ApiController] at the controller headCodePudding user response: