PHP - Descargar PHPExcel por Ajax

 
Vista:
Imágen de perfil de francisco
Val: 93
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Descargar PHPExcel por Ajax

Publicado por francisco (45 intervenciones) el 11/05/2018 22:58:00
Hola muy buenas espero me puedan apoyar con esto...


estoy tratando de hacer la descarga de un archivo excel por medio de ajax pero al mismo tiempo al archivo que quiere descargar le tengo que pasar datos de mi bd para llenar el contenido de tal archivo.
ya lo puedo hacer por medio de un formulario con post

codigo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<form id="formulario" method="POST" action="Caratula.php">
    <table class="table table-condensed table-hover">
        <thead>
            <tr>
                <th>Id</th>
                <th width="40px">NetApp PO </th>
                <th>Costumer N/P</th>
                <th>QTY</th>
                <th>REV</th>
                <th>Boxes by PO</th>
                <th>DN</th>
                <th width="100px">Create Date ASN</th>
                <th width="80px">Shipping Address</th>
                <th>Description</th>
                <th>SO Number</th>
                <th>Procesados</th>
            </tr>
        </thead>
        <tbody class="table table-bordered">
 
            <?php while($elem = $res->fetch()){ ?>
            <tr class="success">
                <td><?php echo $elem["id"]; ?> <input type="checkbox" name="dn[]" value="<?php echo $elem['id'] ?>" id="check"> </td>
                <td><?php echo $elem ["NET_APP_PO"]; ?> </td>
                <td width="40px"><?php echo $elem ["COSTUMER_NP"]; ?></td>
                <td><?php echo $elem ["QTY"]; ?></td>
                <td><?php echo $elem ["REV"]; ?></td>
                <td><?php echo $elem ["BOXES_BY_PO"]; ?></td>
                <td><?php echo $elem ["DN"]; ?></td>
                <td width="100px"><?php echo $elem ["CREATE_DATE_ASN"]; ?></td>
                <td width="80px"><?php echo $elem ["SHIPPING_ADDRESS"]; ?></td>
                <td><?php echo $elem ["DESCRIPTION"]; ?></td>
                <td><?php echo $elem ["SO_Number"]; ?></td>
                <td><?php echo $elem ["procesados"]; ?></td>
                <td></td>
            </tr>
            <?php } ?>
        </tbody>
            <button class="btn btn-info " id="descargar" name="descargar">Descargar <span class="glyphicon glyphicon-save"></span></button>

y me descarga el archivo perfectamente con los datos que selecciono por medio de los checkbox.

pero ahora me gustaria hacerlo por medio de Ajax pero la verdad es que no conosco nada sobre Ajax y no tengo idea de como hacerlo, ya busque en internet y en diferentes foros pero no hay una solucion clara de la cual me pueda guiar

de ante mano gracias por tomarse tu tiempo y contestar se los agradesco mucho...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder