ajax请求获取与多个产品相关的数据

In the print-stock span I want to display the current stock whenever the page loads. The thing is that there could be many products. It would be tedious if I have different api calls for different products. What can I do in the below code so that I can file_get_contents once the relevant stock for that product is displayed in the print-stock span.

If its not possible then in the below code I am calling file_get_contents twice for products one and 2 but i dont get the response data in console.log(data); in the js script only when I call file_get_contents once then the data is console.logged.

<section>
  <div class="col-sm-2" style="border: 1px solid brown; cursor: pointer">
    Product 1<br>
    In stock <span class="print-stock"></span>
    Price 2 USd<br>
  </div>
  <div class="col-sm-2" style="border: 1px solid brown; cursor: pointer">
    Product 2<br>
    In stock <span class="print-stock"></span>
    Price 2 USd<br>
  </div>
</section>

<script>
    $.ajax({
    url:"count.php",
    dataType:'json', 
    success: function(data, status){
       console.log(data);
       console.log(status)
    }
  });
</script>

count.php

<?php 

echo 
file_get_contents('https://*******.com/p.php?%20metod=get_stock%20&service=product1&apikey=m338djl93dke');
echo 
file_get_contents('https://*******.com/p.php?%20metod=get_stock%20&service=product2&apikey=m338djl93dke');
?>

Response data

  {"service":"product1","stock":115}
  {"service":"product2","stock":10,}