I have a table of data on my page. The columns are "start", "end", "comment", and "options". Within the options column is a button to delete the row, and a button that makes a row of the table editable. This allows the values of "start", "end", and "comment" to be changed. Clicking it again finishes the editing process. Finally, there is a way to add another row to the table. All of this works as expected.
I want to add a button at the bottom that creates an array out of the data in the table, that looks like this (represented as JSON purely for ease of showing to SO: not required):
[
{
"start" :"2009/08/01",
"end" :"2009/08/08",
"comment" :"an example date.",
},
{
"start" :"2009/07/01",
"end" :"2009/07/08",
"comment" :"another example date, a month earlier.",
},
{
"start" :"2000/07/01",
"end" :"2000/07/08",
"comment" :"another example date, a year earlier. You get the idea.",
}
]
I shouldn't have too much trouble building the array, but once I have, how can I post it to a backend php script (which will then use put_csv()
to write the data to a file)? Ideally, it would be availiable server-side in a array format, to allow validation.
I'm happy to use jquery, if it's required.