New to jquery/php i have a script i'd like to improve :
I am using TCPDF to generate a pdf that i output via 'F' option locally on my server and sending a simple json response (path/file) to display the pdf in a bootstrap modal (using an iframe).
It's working great but i'd like to send the pdf with 'S' or 'I' option as a binary stream so that i dont have to deal with the file afterward (clean.php to delete the file).
Is this even possible?
Thank you for your help :)
$.ajax({
url: "./../app/renders/pdf_render.php",
type: "POST",
timeout: timeout1,
data: {
id: id_p
},
dataType: 'json',
success: function(json){
if(json.result == 1){ // OK
$("#frame_q").attr("src","../../public/tmp/"+json.file);
// cleaning pdf... doesnt always work with edge
$.ajax({
url: "./../app/renders/clean.php",
type: "POST",
timeout: timeout1,
data: {
file: json.file
},
dataType: 'json'
});
}else{ // NOK
switch(json.result){
case '0' :{ .....