I have a php file that gets an audio blob from a sql database. I need to send that blob to an html page with JavaScript.
Below is my PHP code where I send the blob variable $ubr.
echo json_encode(array('first'=>$ubr));
Below is my JavaScript where I try and receive the blob.
var url = "testThis.php"
var ajax = new XMLHttpRequest();
ajax.open("GET", url, true);
//ajax.send(null);
ajax.onreadystatechange = function () {
if (ajax.readyState == 4 && (ajax.status == 200)) {
var Data = JSON.parse(ajax.responseText);
var b64Data = Data.first;
}
}
I think it's because I'm treating it like a string but Blobs are binary data. Except I'm not sure what else to do.
I need to keep the php data as an array. I will need to send a blob and a string value at the same time.