开发者

How can I submit a DOM table to php?

I have a <table> in a web page that I populate using JavaScript code like this:

var cellBarcode = row.insertCell(1);
var textNode = document.createTextNode(barcode);
cellBarcode.appendChild(textNode);
var cellItemName = row.insertCell(2);
var textNode = document.createTextNode(itemName);
cellItemName.appendChild(textNode);

I need to save its data to my database... So I need to know how I can submit it to php... Is it possible...? If yes, please p开发者_如何学Pythonrovide some sample codes that are easy to understand for a beginner like me... thanks...


Yes, you can submit this information to a server-side script, but not without extra JavaScript code.

The extra JavaScript code would collect the information in the table (either from the DOM you've built, or by accessing the same data you used when building the table) into a string, which can then be sent to the server using one of standard ways.

Since you've used the term "submit", I'm assuming you want to send the table's data as part of an HTML <form> submission, you can put the generated string in an <input type="hidden"> element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜