Converting javascript array to ViewBag or ViewData to acces data from controller -


i have dynamic table in form on save button click accessing whole table , storing array using javascript. following javascript

function savedata() {     var medicinename = new array();     var batchno = new array();     var expirydate = new array();     var qty = new array();     var freeqty = new array();     var purrate = new array();     var mrp = new array();     var sellrate = new array();     var unit = new array();     var amount = new array();     var discper = new array();     var discamt = new array();     var grossamt = new array();     var vatper = new array();     var vatamt = new array();     var addvatper = new array();     var addvatamt = new array();     var netamt = new array();     $("table#tbl1 tr").each(function (row, tr) {     medicinename[row] = $(tr).find('td:eq(1)').text()     batchno[row]  = $(tr).find('td:eq(2)').text()     expirydate[row]  = $(tr).find('td:eq(3)').text()     qty[row]  = $(tr).find('td:eq(4)').text()     freeqty[row]  = $(tr).find('td:eq(5)').text()     purrate[row]  = $(tr).find('td:eq(6)').text()     mrp[row]  = $(tr).find('td:eq(7)').text()     sellrate[row]  = $(tr).find('td:eq(8)').text()     unit[row]  = $(tr).find('td:eq(9)').text()     amount[row]  = $(tr).find('td:eq(10)').text()     discper[row]  = $(tr).find('td:eq(11)').text()     discamt[row]  = $(tr).find('td:eq(12)').text()     grossamt[row]  = $(tr).find('td:eq(13)').text()     vatper[row]  = $(tr).find('td:eq(14)').text()     vatamt[row]  = $(tr).find('td:eq(15)').text()     addvatper[row]  = $(tr).find('td:eq(16)').text()     addvatamt[row]  = $(tr).find('td:eq(17)').text()     netamt[row]  = $(tr).find('td:eq(18)').text()     tabledata.shift();     medicinename.shift();     batchno.shift();     expirydate.shift();     qty.shift();     freeqty.shift();     purrate.shift();     mrp.shift();     sellrate.shift();     unit.shift();     amount.shift();     discper.shift();     discamt.shift();     grossamt.shift();     vatper.shift();     vatamt.shift();     addvatper.shift();     addvatamt.shift();     netamt.shift(); } 

now want store in viewbag or viewdata or more efficient way 2 controller.

note: dont have save value of table there couple other fields storing , things inter related want done thing @ once not calling other function first save data , other function other data of same form


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -