我有一个提示表单的JavaScript文件。用户填写数据并单击“提交”后,数据将存储在JavaScript数组中。
如何从.jsp文件中的.js文件中检索/显示此数组?
$(document).ready(function() {
var table = [];
//data filled will be stored in array called table[]
$("#send").click(function() {
var kpiName = $("#kpiName").val();
var startDate = $("#startDate").val();
var endDate = $("#endDate").val();
var value = $("#value").val();
var unit = $("#unit").val();
if (kpiName === "" || startDate === "" || endDate === "" || value === "" || unit=== "") {
alert("Please Fill All Fields");
}
else {
table.push({
kpiName: kpiName,
startDate: startDate,
endDate: endDate,
value: value,
unit: unit
});
$("#contactdiv").css("display", "none");
});