function saveData(name, data_in){
    //var url = 'record_result.php';
    //var data_to_send = {filename: name, filedata: data_in};
    //fetch(url, {
      //  method: 'POST',
      //  body: JSON.stringify(data_to_send),
      //  headers: new Headers({
      //          'Content-Type': 'application/json'
      //  })
    //});
    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'record_result.php');
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.send(JSON.stringify({filename: name, filedata: data_in}));
}
