Help, my idea is to press the request file on a row and that will be sent to me or address loading the file

0
function cargaPagina(pagina)
{
  var desde = pagina * itemsPorPagina;

  $.ajax({
    data:{"param1":"dame","limit":itemsPorPagina,"offset":desde},
    type:"GET",
    dataType:"json",
    url:"Conexion_Mostrar_Solicitud_Pedido.php"
  }).done(function(data,textStatus,jqXHR){

    var lista = data.lista;

    $("#miTabla").html("");

    $.each(lista, function(ind, elem){

      $("<tr>"+

        "<td>"+elem.id_solicitud_pedido+"</td>"+
        "<td>"+elem.nombre_contacto_empresa+"</td>"+
        "<td>"+elem.empresa_solicitud_pedido+"</td>"+
        "<td>"+elem.archivo_solicitud_pedido + "</td>"+
        "<td>"+elem.fecha_solicitud_pedido+"</td>"+
        "</tr>").appendTo($("#miTabla"));


    });     


  }).fail(function(jqXHR,textStatus,textError){
    alert("Error al realizar la peticion dame".textError);

  });
    
asked by Keane 17.09.2017 в 04:13
source

1 answer

0

Regards

For that to happen, it depends how the Acrobat PlugIns is configured for Show PDF in a browser ; assuming it is okay (this depends on the client's side); all you have to do is open a ventna; an easy way is to use the <a></a> tag below a suggestion:

<a href="http://misitio/algunaruta/MiPDF.pdf" target="_blank">
Click para abrir pdf
</a>

As you want it within a column of your table try one of the following to give you an idea and opt for the one you prefer:

<a href="http://misitio/algunaruta/MiPDF.pdf" 
         target="_blank" style="width:100%; height:auto;">
Click para abrir pdf
</a>

or

<a href="http://misitio/algunaruta/MiPDF.pdf" target="_blank">
<div style="width:100%; height:auto;">
Click para abrir pdf
</div>
</a>
  

For the height try with 100% and auto which works; the intention is to extend it to the height and width of td where you place it.

What I put as http://misitio/algunaruta/MiPDF.pdf is direct if the PDF exists; that is, but it can be an ink where you create the PDF on the fly; clear replacing as it should be.

With target="_blank" it is indicated that it opens in a new window; other values for target as required.

  

The part that allows to open with the web browser in another window the   I really have not understood it well; for example commonly first   you must have installed (the visitor) at least Adobe Acrobat   Reader (and with it the PlugIns) however I have Chrome and I have not   installed similar program or the Plugins and the Chrome opens, in order.

I hope it will be useful or guidance.

  

EDITED

In consideration that you will put it in "<td>"+elem.archivo_solicitud_pedido + "</td>" ; It would be something like:

"<td> <a href=\"http://misitio/algunaruta/"+elem.archivo_solicitud_pedido + "\" target="_blank">
    <div style=\"width:100%; height:auto;\">
    Click para abrir pdf
    </div>
    </a></td>"

As I do not know the path of the file, let what you exemplify; so you'll have to put http://misitio/algunaruta/ as appropriate I'm assuming that elem.archivo_solicitud_pedido is the file name that should be opened.

    
answered by 17.09.2017 / 05:16
source