[英]Pass Array as a parameter in Javascript
This function is used to check if the checkbox is selected or not.Can somebody help how to pass the array as a parameter to URL which will call a stored procedure. 该函数用于检查是否选中了该复选框。有人可以帮助如何将数组作为参数传递给URL,该URL将调用存储过程。
function js_remove_masters(theForm) {
var vCheckedCount = 0;
var vContinue = true;
var mycheckedarr = [];
var myuncheckedarr = [];
//check to see if anything is selected
if ((theForm.selected.length == null) && (!(theForm.selected.checked))) {
vContinue = false;
alert("Please select an item to be deleted.");
} else if (theForm.selected.length != null) {
for (var i = 0; i < theForm.selected.length; i++) {
if (theForm.selected[i].checked) {
vCheckedCount = 1;
mycheckedarr.push = theForm.selected[i].value;
} else {
myuncheckedarr.push = theForm.selected[i].value;
}
}
if (vCheckedCount == 0) {
vContinue = false;
alert("Please select an item to be deleted.");
}
}
if (vContinue) {
theForm.action = ("library_search_pkg_nv1.remove_checkin_masters");
-- - here how to pass array parameters
theForm.submit();
}
}
procedure remove_masters(
masterID in smallarray
default smallempty,
masterIDunselected in smallarray
default smallempty
);
Just get rid of the JavaScript entirely. 完全摆脱JavaScript。 You are submitting the form.
您正在提交表格。
If a checkbox is checked then its name/value pair will be included in the form data. 如果选中复选框,则其名称/值对将包含在表单数据中。
If it isn't checked, then it won't be. 如果未选中,则不会。
If you have a bunch of checkboxes (or other elements) with the same name, then most server side form data parsing libraries will express that as an array automatically. 如果您有一堆具有相同名称的复选框(或其他元素),则大多数服务器端表单数据解析库会将其自动表示为数组。 The main exception is PHP which requires that you put
[]
on the end of the name first. 主要的例外是PHP,它要求您首先将
[]
放在名称的末尾。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.