[
["11.09.2018",222],
["12.09.2018",392],
["13.09.2018",485],
["14.09.2018",449],
["15.09.2018",449],
["16.09.2018",449],
["17.09.2018",449],
["18.09.2018",449]
]
<form action="#" id="test">
<input type="date" name="date">
<input type="number" name="num">
<input type="submit">
</form>
$(function(){
$('#test').on('submit', function(){
let data = $(this).serialize();
$.ajax({
method: 'POST',
url: 'test.php',
data: data
}).done(function( msg ){
console.log( msg );
});
return false;
});
});
$file = file_get_contents('data.json');
$list = json_decode($file,TRUE);
unset($file);
$list[] = [ $_POST['date'], $_POST['num'] ];
file_put_contents('data.json',json_encode($list));