I want to track user interaction with a plugin written in jquery which is storing some multi-mensional arrays. I want to save those arrays into mysql database or into a file which I can display later.
The array looks like this:
var data = [ [381, 143, 0, 0, 0, 250, 1],[367, 147, 0, 0, 0, 250, 2],[367, 147, 0, 0, 1, 249, 3] ];
Basically this plugin just records positions into the arrays and displays animation on screen where the user clicks.
Here is an example how this script is working:
var myRecord =new viewRec({interval:250});
var data = [ [381, 143, 0, 0, 0, 250, 1],[367, 147, 0, 0, 0, 250, 2],[367, 147, 0, 0, 1, 249, 3] ];
myRecord.setData(data);
myRecord.play();
You might want to JSON.stringify(data, null, ' ') to make the array into a JSON and then write the JSON to MySQL.
When you want to get the data, get it from MySQL and do JSON.parse(datafrommysql); to get the multidimensional array for your processing needs.
JSON vs XML : https://www.w3schools.com/js/js_json_xml.asp
Documentation on JSON supported data types : https://www.w3schools.com/js/js_json_datatypes.asp
Documentation on JSON.parse : https://www.w3schools.com/js/js_json_parse.asp
Documentation on JSON.stringify : https://www.w3schools.com/js/js_json_stringify.asp