Then click the plus button to get the data
CodePudding user response:
This problem can be divided into two steps, one is how to get the selected rows, the other is how to preach the past scenes,How to get the selected rows, the check layui document will be more accurate, I remember there is a checkStatus functions, such as access to the currently selected rows, if you have a list of pages, then you have to use layui provide storage checkbox events selected row,
After you access to the selected rows, you can use the specified delimiter row ids, you can also use json to submit to background,
This kind of problem solution, or not to use layui, is pretty much the same,
CodePudding user response:
More than access to the data, how to pass into the background?CodePudding user response:
Introduced the background reference batch submission, in the form of an array to submit or by way of joining together into a fixed string delimiter submitted canSubmission have traditional submit with ajax
CodePudding user response:
Is there a specific case, let me consider, thank youCodePudding user response:
The official sampleCodePudding user response:
Officials have instances of the 6th floor, and then through ajax sent to the server, the server parsed json bag and saveCodePudding user response:
Ok, thank you!CodePudding user response:
Ask again, how to obtain an array of into the backgroundI like writing, only a data transfer
CodePudding user response:
Var checkStatus=table. CheckStatus (' XXXTable ');
If (checkStatus. Data. Length==0) {
Msg_Warn (' please select data ', ');
return;
}
The console. The log (checkStatus. Data);
AjaxPost (
'XXXXXa/XXXX,
CheckStatus data,
The function (res) {
If (res!=null & amp; & Res! {
="")Var json=eval (" (" + res + ") ");
If (json. Code==0) {
//success
}
The else {
//failure
}
}
}, ' ', ');
//Post request packaging
The function AjaxPost (url, data, success, error, complete) {
Var header={};
The content-type header ["] "=" application/json ";
$. Ajax ({
Type: "POST",
Url: the url,
Headers: header,
Data: JSON. Stringify (data),
Async: true,
Success: the function (res) {
//console.log(res);
Var json=eval (" (" + res + ") ");
If (json. Code==301) {
//token expired
Alert (" token expired ");
}
Else if (json. Code==302) {
//token illegal
Alert (" token illegal ");
}
The else {
Success (res)
}
},
Error: function (err) {
The error & amp; & Error (err);
},
Complete: a function (res) {
Complete & amp; & Complete (err);
}
});
}