How do I add data into a database from an HTML table?
My table is like this:
html += "<table>";
html += "<tr><th>" + "A" + "</th><th>" + "B" + "</th><th>" + "C" + </th></tr>";
html += "<tr><td>" + "0" + "</td><td>" + "1" + "</td><td>" + "2" + </td></tr>";
html += "</table>";
I’m calling the HTML from the server side.
if you like plain HTML, you can use a JavaScript framework like Knockout.js along with it. Knockout.js allows you to inject data into HTML using JavaScript View Models. A button click can be assigned to a JavaScript function in the View Model. The JavaScript function can do an AJAX post to call a controller action method on the server side – which will insert the data into the database.
For more information about knockout, check http://knockoutjs.com