Struggling with making an AJAX POST successfully upload and retrieve a base64 string to/from my SQL database. Upon receiving the string from the database via AJAX, it appears to be the same base64 string, but with random line breaks that render it non-functional.
In the console, the top shows the incorrectly formatted base64, while the bottom displays it correctly.
Upon inspecting the base64 string in the SQL database, it appears to be incorrectly formatted, indicating a potential issue with the initial AJAX upload. The SQL datatype is set to MEDIUMTEXT, but changing it did not affect the outcome.
// Retrieving the base64 string
let canvas = picCheckIn.getContext("2d")
let dataURL = canvas.canvas.img.src
// Hard-coding the base64 string into the image's source
imgPreviousIn.src="data:image/jpeg;base64,/9j/4A...<Rest of base64 string>"
// Assigning the AJAX base64 string to the image source
let req = Ajax(<POST query here...>)
let results = JSON.parse(req.responseText)
imgPreviousIn.src=results[0][0]
Encountering the following error code:
GET data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gKgSUNDX1... net::ERR_INVALID_URL