简体   繁体   中英

passing all table data from jsp to servlet

I have user editable table at front end. when user click process button, i am doing form validation in jquery from there i am passing flow to servlet, So i have to pass the bunch of table data to servlet. Some one please suggest me on how to pass all table data in ajax call. Currenly i have a piece of code which contains table data in array where i can get as each cell values. instead of that i wanna pass it in row manner

 var InspTableArray = []; $("#tab_logic tr.data").map(function (index, tr) { $(this).find('td').each(function(){ var $data = $(this).html(); if($(this).find("select").length > 0) { var $x = $(this).find("select").val(); }else{ var $x = $(this).find("input[type='text']").val(); } InspTableArray.push($x); }); }); 

我建议使用jQuery post方法https://api.jquery.com/jquery.post/

$.post('/url/to/page', {'arrayFieldName': InspTableArray} );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM