I have a page that generates json data from several fields and I want to send it to a mysql database.
I currently have a link, the user clicks the link, the javascript takes the information they’ve inputed and sends it to a server. Due to the nature, I need all the data in one field in the mysql database. Any ideas?
EDIT:
The data comes from several contenteditable divs, in such a way that there is a specific hierarchy.
Such as
Data : {
Heading : 1,
info1 : 1,
info2 : 2,
info3 : 3
},{
Heading : 2,
info1 : 1,
info2 : 2,
info3 : 3
}
You can use a AJAX post. E.g.:
To make sure you have JSON.stringify, use json2. The
contentTypemeans you are posting a JSON document, thedataTypemeans you expect to receive one from the server.On the server, you use
json_decodeto decode, andjson_encodeto encode a response.