我有以下javascript函数,在jsp页面的下拉框中选择一个选项时会被调用:
curl --verbose -X POST "http://<host>/auth/realms/master/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
-d 'client_id=admin_cli' \
-d "requested_subject=${USER_ID}" \
-d "subject_token=${TKN}"
以下是HTML代码:
function getApplication(val)
{
$("#accVerMessageDiv").html("");
var accVersion = document.getElementById("account_version").value;
// var optionValue = accVersion.options[accVersion.selectedIndex].value;
if(accVersion == "0"){
disable();
}
if(accVersion == ""){
alert("Please select any Application");
disable();
}
else
{
enable();
}
document.getElementById("rowDataIdAccountVersion").value=accVersion;
$.ajax({
type: "POST",
url: "CalculateFTE",
data: {"action":"searchData",
"account_version":accVersion},
success: function(data,jqXHR){
$("#accVerMessageDiv").html("");
var col = [];
for (var i = 0; i < data.length; i++) {
for (var key in data[i]) {
if (col.indexOf(key) === -1) {
col.push(key);
}
}
}
/* for (var i = 0; i < col.length; i++) {
col[i] = col[i].toUpperCase();
} */
//col.push("Actions");
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
// CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE.
var tr = table.insertRow(-1); // TABLE ROW.
for (var i = 0; i < col.length; i++) {
var th = document.createElement("th"); // TABLE HEADER.
th.style.backgroundColor = "#c1c1c1";
th.innerHTML = col[i].toUpperCase();
tr.appendChild(th);
}
// ADD JSON DATA TO THE TABLE AS ROWS.
for (var i = 0; i < data.length; i++) {
tr = table.insertRow(-1);
for (var j = 0; j < col.length; j++) {
var tabCell = tr.insertCell(-1);
//alert("==data[i]=="+i+"==[col[j]]=="+j+"==="+data[i][col[j]]);
var primKey = data[i][col[3]] ;
/* if(data[i][col[j]] == undefined && j==4)
{
// tabCell.innerHTML = "";
//tabCell.innerHTML = '<a href=\"edit.jsp?accId='+primKey+'\">EDIT</a>';
tabCell.innerHTML = '<a href=\"javascript:rowEditApplication('+primKey+')\">EDIT</a>';
}
else */ if(data[i][col[j]] == undefined)
{
tabCell.innerHTML = "";
}
else
tabCell.innerHTML = data[i][col[j]];
}
}
// FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER.
var divContainer = document.getElementById("searchDataAccountVersion");
divContainer.innerHTML = "";
divContainer.appendChild(table);
},
error:function(data,jqXHR)
{
$("#accVerMessageDiv").html("No Data Found.");
//$("#accMessageDiv").html(data);
},
beforeSend: function() {
// setting a timeout
},
complete: function()
{
}
});
}
我想隐藏从下拉框中选择任何选项后将在jsp页面上查看的结果中的第3列。结果中总共有4列。我想隐藏最后一栏。请帮助我实现这一目标。