title: Update multiple div contents with json values received from server
body: <p>I have a page with multiple divs in it. I like to update the text inside these divs with the json response I get from the server. </p>
  
  <p>The sample div looks like this</p>
  
  <pre><code>&lt;div class="mprice" name="&lt;?php echo $product['product_id']; ?&gt;"&gt;
      &lt;?php echo $product['price']; ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have many of these divs on my page each one of them with a unique product_id as their name. I'm trying to update these prices every couple seconds. </p>
  
  <p>So I have created an Ajax function that gets called on an interval to retrieve the new prices in json format.</p>
  
  <p>json response that ajax is getting looks like this:</p>
  
  <pre><code>    {"products":[
      {"product_id":"43","price":"C$ 200.54"},
      {"product_id":"44","price":"C$ 928.08"},
      {"product_id":"46","price":"C$ 498.44"}
  
  ]}
  </code></pre>
  
  <p>Now I am trying to find a way to update all the prices in the div elements where their name is equal to the product_id with their corresponding price coming from json. I'm using jQuery. I've been on this for hours.</p>