Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have added some mock JSON, there was a typo in the spelling of <code>Unavailable</code> in the first one. This is only the <code>each</code> section of the AJAX success function which is correct. You can see this working on <a href="http://jsfiddle.net/mhWdP/" rel="nofollow">http://jsfiddle.net/mhWdP/</a></p> <p>Hope that helps. R.</p> <pre><code>JsonData = [{ "InStock": "In Stock", "MerchantName": "Coffee for Less", "PageURL": "http://www.google.com", "Price": "14.99" }, { "InStock": "Unavailable", "MerchantName": "Drugstore", "PageURL": "http://www.google.com", "Price": "15.99" }, { "InStock": "No", "MerchantName": "Drugstore2", "PageURL": "http://www.google.com", "Price": "29.99" }]; $.each(JsonData, function (index, dataItem) { stockStatus = ''; if (dataItem.InStock == "In Stock") { stockStatus = "Yes"; } else if (dataItem.InStock == "Unavailable") { stockStatus = "No"; } else { stockStatus = "-"; } tempRow = document.createElement('tr'); $(tempRow).append("&lt;td class='store-row'&gt;&lt;h5 property='seller'&gt;" + dataItem.MerchantName + "&lt;/h5&gt;&lt;/td&gt;") .append("&lt;td class='price-row'&gt;&lt;h5 property='price'&gt;$" + dataItem.Price + "&lt;/h5&gt;&lt;/td&gt;") .append("&lt;td class='in-stock-row'&gt;&lt;h5&gt;" + stockStatus + "&lt;/h5&gt;&lt;/td&gt;") .append("&lt;td class='merch-row'&gt;&lt;a property='url' target='_blank' href='" + dataItem.PageURL + "' class='merch-but'&gt;GET IT&lt;/a&gt;&lt;/td&gt;") .append("&lt;/tr&gt;"); $(".price-data").append(tempRow); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload