-1
good afternoon!
I am some time trying to turn a table dynamically coming from the database to an Excel file.
The procedure I do is to take this table via Javascript, send it to a PHP file via Ajax and in this file force the download of the table in Excel. What is not working is "Force" the file download.
// Gerar tabela statica via Ajax
tabelaHtml = document.getElementById("table").innerHTML;
$("#exportar").click(function(){
$.ajax({
type: "POST",
url: "recebe-dados.php",
cache: false,
data:{
origem: '<?php echo "$origem"; ?>',
dadosExcel: tabelaHtml
},
success: function(e){
alert("Dados exportados com sucesso!");
console.log(e);
},
error: function(e){
alert("Houve algum problema, tente novamente mais tarde!");
console.error(e);
}
});
});
<em>mv1.com.br | LP Pré-matrícula</em>
<tbody><tr class="separador">
<td colspan="7">02/09/2019 = <strong id="cont_1">2</strong></td>
</tr><script>$("#cont_1").html("1");</script> <tr name="tr_table">
<td>626</td>
<td>Leandro Dutra Ribeiro</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(22) 98170-0530</td>
<td>2019-09-02 10:10:20</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_1").html("2");</script> <tr name="tr_table">
<td>627</td>
<td>Pwmranbwajve</td>
<td>[email protected]</td>
<td></td>
<td>5066343676</td>
<td>2019-09-02 21:45:42</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">04/09/2019 = <strong id="cont_2">3</strong></td>
</tr><script>$("#cont_2").html("1");</script> <tr name="tr_table">
<td>628</td>
<td>Renata de Andrade Ribeiro</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(21) 97593-1215</td>
<td>2019-09-04 07:13:23</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_2").html("2");</script> <tr name="tr_table">
<td>629</td>
<td>Juliana Candido Bastos Almeida</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 99748-4757</td>
<td>2019-09-04 10:35:55</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_2").html("3");</script> <tr name="tr_table">
<td>630</td>
<td>Beatriz Imbroisi Ximenes</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(21) 96450-4605</td>
<td>2019-09-04 11:32:50</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">05/09/2019 = <strong id="cont_3">1</strong></td>
</tr><script>$("#cont_3").html("1");</script> <tr name="tr_table">
<td>631</td>
<td>Beatriz Pensabem de Menezes Guimarães</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 3583-3551</td>
<td>2019-09-05 15:15:12</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">06/09/2019 = <strong id="cont_4">3</strong></td>
</tr><script>$("#cont_4").html("1");</script> <tr name="tr_table">
<td>632</td>
<td>Maira de Souza</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 99488-3420</td>
<td>2019-09-06 15:25:08</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_4").html("2");</script> <tr name="tr_table">
<td>633</td>
<td>Kelly Cristina Garcia de Figueiredo</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98083-7461</td>
<td>2019-09-06 17:26:28</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_4").html("3");</script> <tr name="tr_table">
<td>634</td>
<td>Daniele dos Santos Xavier</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 99994-3168</td>
<td>2019-09-06 19:18:51</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">07/09/2019 = <strong id="cont_5">2</strong></td>
</tr><script>$("#cont_5").html("1");</script> <tr name="tr_table">
<td>635</td>
<td>Mariana Dias Sampaio</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 96511-5066</td>
<td>2019-09-07 11:28:50</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_5").html("2");</script> <tr name="tr_table">
<td>636</td>
<td>Aclessiani</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99885-1763</td>
<td>2019-09-07 14:41:06</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">09/09/2019 = <strong id="cont_6">7</strong></td>
</tr><script>$("#cont_6").html("1");</script> <tr name="tr_table">
<td>637</td>
<td>Gazlcfudonkb</td>
<td>[email protected]</td>
<td></td>
<td>3069411081</td>
<td>2019-09-09 08:40:17</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_6").html("2");</script> <tr name="tr_table">
<td>638</td>
<td>Vinícius Alves Couzi</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99878-2303</td>
<td>2019-09-09 12:05:35</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_6").html("3");</script> <tr name="tr_table">
<td>639</td>
<td>Fernando Sergio Teixeira dos Santos</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98135-8961</td>
<td>2019-09-09 13:14:49</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_6").html("4");</script> <tr name="tr_table">
<td>640</td>
<td>Juliana Rodrigues de Mello</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 97014-7127</td>
<td>2019-09-09 14:44:59</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_6").html("5");</script> <tr name="tr_table">
<td>641</td>
<td>Juliana Rodrigues de Mello</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 97014-7127</td>
<td>2019-09-09 14:45:29</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_6").html("6");</script> <tr name="tr_table">
<td>642</td>
<td>Andrea Pinto Leite Ribeiro</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 9832-58871</td>
<td>2019-09-09 15:27:55</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_6").html("7");</script> <tr name="tr_table">
<td>643</td>
<td>Fernanda da Costa Diniz</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 99389-3390</td>
<td>2019-09-09 16:27:17</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">11/09/2019 = <strong id="cont_7">5</strong></td>
</tr><script>$("#cont_7").html("1");</script> <tr name="tr_table">
<td>644</td>
<td>Isabel C T Bergonzi</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98059-9201</td>
<td>2019-09-11 07:09:13</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_7").html("2");</script> <tr name="tr_table">
<td>645</td>
<td>Thais Miguel</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>24999553326</td>
<td>2019-09-11 12:52:06</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_7").html("3");</script> <tr name="tr_table">
<td>646</td>
<td>Lislaine Sperandio Mendes</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 98538-0528</td>
<td>2019-09-11 14:42:12</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_7").html("4");</script> <tr name="tr_table">
<td>647</td>
<td>Paula Lopez</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 97281-7709</td>
<td>2019-09-11 17:21:14</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_7").html("5");</script> <tr name="tr_table">
<td>648</td>
<td>Talyne Mayana Ferreira Sales</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(71) 99616-8935</td>
<td>2019-09-11 20:22:06</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">12/09/2019 = <strong id="cont_8">3</strong></td>
</tr><script>$("#cont_8").html("1");</script> <tr name="tr_table">
<td>649</td>
<td>Dora</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(21) 97415-8318</td>
<td>2019-09-12 11:42:07</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_8").html("2");</script> <tr name="tr_table">
<td>650</td>
<td>Rosimeire Parra Macedo</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98170-5838</td>
<td>2019-09-12 21:51:00</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_8").html("3");</script> <tr name="tr_table">
<td>651</td>
<td>Rosimeire Parra Macedo</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98170-5838</td>
<td>2019-09-12 21:51:37</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">13/09/2019 = <strong id="cont_9">7</strong></td>
</tr><script>$("#cont_9").html("1");</script> <tr name="tr_table">
<td>652</td>
<td>Teste Pai</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99999-9999</td>
<td>2019-09-13 10:52:16</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_9").html("2");</script> <tr name="tr_table">
<td>653</td>
<td>Aluno Teste Setembro</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 12345-6789</td>
<td>2019-09-13 11:51:36</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_9").html("3");</script> <tr name="tr_table">
<td>654</td>
<td>Davi Teodoro Pereira</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99831-3816</td>
<td>2019-09-13 11:53:12</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_9").html("4");</script> <tr name="tr_table">
<td>655</td>
<td>Luciana Barcellos de Paula Motta</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99257-9444</td>
<td>2019-09-13 15:29:24</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_9").html("5");</script> <tr name="tr_table">
<td>656</td>
<td>Narciso Felicio de Lima Junior</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(21) 98082-0991</td>
<td>2019-09-13 17:45:48</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_9").html("6");</script> <tr name="tr_table">
<td>657</td>
<td>Leonardo Mendes Santiago</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98292-5932</td>
<td>2019-09-13 20:58:53</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_9").html("7");</script> <tr name="tr_table">
<td>658</td>
<td>Juan Filgueiras</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>21967796737</td>
<td>2019-09-13 23:37:10</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">14/09/2019 = <strong id="cont_10">2</strong></td>
</tr><script>$("#cont_10").html("1");</script> <tr name="tr_table">
<td>659</td>
<td>Patrícia de Abreu Cândido</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 97401-5585</td>
<td>2019-09-14 17:02:54</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_10").html("2");</script> <tr name="tr_table">
<td>660</td>
<td>Lucia de Figueiredo Souza Rodrigues</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 97681-6929</td>
<td>2019-09-14 21:41:49</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">15/09/2019 = <strong id="cont_11">2</strong></td>
</tr><script>$("#cont_11").html("1");</script> <tr name="tr_table">
<td>661</td>
<td>Karine Conceição da Costa</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 97022-0975</td>
<td>2019-09-15 21:32:18</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_11").html("2");</script> <tr name="tr_table">
<td>662</td>
<td>Karine Conceição da Costa</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 97022-0975</td>
<td>2019-09-15 21:34:03</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">16/09/2019 = <strong id="cont_12">7</strong></td>
</tr><script>$("#cont_12").html("1");</script> <tr name="tr_table">
<td>663</td>
<td>Ferbando António Orlando da Rocha</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99215-8008</td>
<td>2019-09-16 11:56:38</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_12").html("2");</script> <tr name="tr_table">
<td>664</td>
<td>Ferbando António Orlando da Rocha</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99215-8008</td>
<td>2019-09-16 11:57:41</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_12").html("3");</script> <tr name="tr_table">
<td>665</td>
<td>Mariana Leao</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98272-7716</td>
<td>2019-09-16 13:42:48</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_12").html("4");</script> <tr name="tr_table">
<td>666</td>
<td>Priscilla Cruz</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 96913-3837</td>
<td>2019-09-16 14:37:31</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_12").html("5");</script> <tr name="tr_table">
<td>667</td>
<td>Flavio da Cruz Lima</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(71) 99984-4516</td>
<td>2019-09-16 14:43:51</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_12").html("6");</script> <tr name="tr_table">
<td>668</td>
<td>Flavio da Cruz Lima</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(71) 99984-4516</td>
<td>2019-09-16 14:44:29</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_12").html("7");</script> <tr name="tr_table">
<td>669</td>
<td>Adelcio Lara de Resende</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(31) 98801-0454</td>
<td>2019-09-16 16:13:05</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">17/09/2019 = <strong id="cont_13">11</strong></td>
</tr><script>$("#cont_13").html("1");</script> <tr name="tr_table">
<td>670</td>
<td>Juliana Silva</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 99389-2663</td>
<td>2019-09-17 09:25:23</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("2");</script> <tr name="tr_table">
<td>671</td>
<td>Ana Paula Araujo A. Vieira</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 9791-25083</td>
<td>2019-09-17 12:39:01</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("3");</script> <tr name="tr_table">
<td>672</td>
<td>Sheila da Silva Amaral</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 98331-5005</td>
<td>2019-09-17 13:16:46</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("4");</script> <tr name="tr_table">
<td>673</td>
<td>Fernando Oliveira Pinto</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 9817-41423</td>
<td>2019-09-17 15:31:34</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("5");</script> <tr name="tr_table">
<td>674</td>
<td>Rondinele Santos Andrade</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 99691-0618</td>
<td>2019-09-17 15:31:49</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("6");</script> <tr name="tr_table">
<td>675</td>
<td>Lorena Ribeiro Molinaro</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 99115-0506</td>
<td>2019-09-17 15:34:38</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("7");</script> <tr name="tr_table">
<td>676</td>
<td>Luzivanda Almeida de Oliveira</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(21) 98881-6044</td>
<td>2019-09-17 15:38:34</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("8");</script> <tr name="tr_table">
<td>677</td>
<td>William Alves Ferreira</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(24) 99843-0984</td>
<td>2019-09-17 17:08:34</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("9");</script> <tr name="tr_table">
<td>678</td>
<td>Elismar Batista Duarte</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(21) 99568-0934</td>
<td>2019-09-17 19:05:56</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("10");</script> <tr name="tr_table">
<td>679</td>
<td>Marcelo de Souza Mendonça</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 3350-0532</td>
<td>2019-09-17 21:50:21</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_13").html("11");</script> <tr name="tr_table">
<td>680</td>
<td>Marcelo Braga</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(21) 98686-1207</td>
<td>2019-09-17 22:04:08</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">18/09/2019 = <strong id="cont_14">4</strong></td>
</tr><script>$("#cont_14").html("1");</script> <tr name="tr_table">
<td>681</td>
<td>Diane Cunha Gonçalves</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(24) 99237-7926</td>
<td>2019-09-18 12:08:46</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_14").html("2");</script> <tr name="tr_table">
<td>682</td>
<td>Lucilene</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 98371-4577</td>
<td>2019-09-18 14:07:57</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_14").html("3");</script> <tr name="tr_table">
<td>683</td>
<td>Nathalia Lameira Lisboa</td>
<td>[email protected]</td>
<td>Icaraí</td>
<td>(21) 98077-1729</td>
<td>2019-09-18 17:41:00</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_14").html("4");</script> <tr name="tr_table">
<td>684</td>
<td>Sergio Guimarães Soares</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 97349-0967</td>
<td>2019-09-18 21:36:16</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">19/09/2019 = <strong id="cont_15">4</strong></td>
</tr><script>$("#cont_15").html("1");</script> <tr name="tr_table">
<td>685</td>
<td>Neuza Maria Gomes Leao</td>
<td>[email protected]</td>
<td>Tijuca</td>
<td>(21) 99266-0311</td>
<td>2019-09-19 10:30:48</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_15").html("2");</script> <tr name="tr_table">
<td>686</td>
<td>Deyse Sant Anna dos Santos</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 98825-6713</td>
<td>2019-09-19 15:30:41</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_15").html("3");</script> <tr name="tr_table">
<td>687</td>
<td>Staffony Katry Fonseca dos Santos</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 99096-3737</td>
<td>2019-09-19 19:11:35</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_15").html("4");</script> <tr name="tr_table">
<td>688</td>
<td>Marcia Loredo Pereira</td>
<td>[email protected]</td>
<td>Ilha</td>
<td>(21) 98341-8920</td>
<td>2019-09-19 22:56:15</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<tr class="separador">
<td colspan="7">20/09/2019 = <strong id="cont_16">3</strong></td>
</tr><script>$("#cont_16").html("1");</script> <tr name="tr_table">
<td>689</td>
<td>Juliana</td>
<td>[email protected]</td>
<td>São Gonçalo</td>
<td>(21) 98400-9468</td>
<td>2019-09-20 16:18:48</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
<script>$("#cont_16").html("2");</script> <tr name="tr_table">
<td>690</td>
<td>Mariana Pinto Vieira Souto</td>
<td>[email protected]</td>
<td>Volta Redonda</td>
<td>(22) 99787-4749</td>
<td>2019-09-20 19:54:40</td>
<td><em>mv1.com.br | LP Pré-matrícula</em></td>
</tr>
</tbody>
PHP CODE BELOW:
<?php
if(isset($_POST['dadosExcel']) && $_POST['dadosExcel'] != ''){
$nomeTabela = $_POST['origem'];
$tabela = $_POST['dadosExcel'];
$arquivo = $nomeTabela . '.xls';
header('Content-Type: application/x-msexcel');
header('Content-type: application/force-download');
header("Content-Disposition: attachment; filename=\"{$arquivo}\"");
header("Content-Description: PHP Generated Data" );
/*header("Content-type: application/vnd.ms-excel");
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=$arquivo.xls");
header("Pragma: no-cache");*/
echo $arquivo;
echo $tabela;
}else{
echo "Não possivel completar a exportação!";
}
*** Some solutions I tried was to call the file at the top of the document before any html, which didn’t work.