1
I’m trying to get an answer to whether the Phpexcel already downloaded, to then proceed with my algorithm.
I tried to put in my phpexcel file the following line before Exit;
echo json_encode(array("teste" => 1));
But it doesn’t work. It returns as undefined
$.ajax({
type : 'post',
url : 'services/'+url,
data : {
data : competencia
},
success: function (data) {
if(data.teste === 1)
alert('baixou');
else
alert('nao baixou: '+data.teste);
}
});
Instead of
echo
, try adie(json_encode(array("teste" => 1)));
and let me know what happened.– Don't Panic
but I take out the Exit you have at the end?
– adventistaam
die will stop the process and return the content that was placed inside. You can leave everything as it is and just make the change;
– Don't Panic
he delayed and returned undefined
– adventistaam
Well, let’s go to the next and last test,,
$.ajax({
 type : 'post',
 url : 'services/'+url,
 datatype: 'json',
 data : {
 data : competencia
 },
 success: function (data) {
 if(data.teste === 1)
 alert('baixou');
 else
 alert('nao baixou: '+data.teste);
 }
});
– Don't Panic
Nothing. Now neither Alert shows more. But it was worth the intention to help
– adventistaam
var form = $('<form action="services/'+url+'" method="post" >'+
 '<input type="hidden" value="'+competencia+'" name="data" />'+
 '</form>');
 $('body').append(form);
 form.submit()
if I put this command works, but I have no way to know the return in jquery– adventistaam
I would like you to update the page only after downloading
– adventistaam