Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
Json parse url prestashop webservice

I ask you a question.

I need to parse a JSON coming from the Prestashop WebService.

At the moment I have saved all the JSON locally, in a file, I show it in a table and it works.

The code I'm using is this:

/// Read JSON
<script>
  $ ('# loan'). DataTable ({
       ajax: {
         url: 'products.json',
         dataSrc: 'products'
       },
       "columns": [
            {"data": "name"},
            {"data": "active"},
            {"data": "description"}
       ]
  });
</script>

My question is: How can I directly use the url (https://www.mywebsite.com/shop/api/products/?ws_key=ws_key?&output_format=JSON&display=full) instead of using the above method?

Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I hope one of these helps:

Using cURL

$url = 'https://www.mywebsite.com/shop/api/products/?ws_key=ws_key?&output_format=JSON&display=full';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
curl_close($ch);

var_dump(json_decode($result, true));

Using AJAX

$.ajax({
    type:"GET", 
    url: "https://www.mywebsite.com/shop/api/products/?ws_key=ws_key?&output_format=JSON&display=full", 
    success: function(data) {
            console.warn(data);
        }, 
    error: function(jqXHR, textStatus, errorThrown) {
            alert(jqXHR.status);
        },
   dataType: "jsonp"
});​​​​​​​​​​​​​​​
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda