Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!