<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Thank you, Diego! in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Displaying-json-data-in-HTML/m-p/1120681#M75978</link>
    <description>&lt;P&gt;Thank you, Diego!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jul 2016 00:03:00 GMT</pubDate>
    <dc:creator>xkevin</dc:creator>
    <dc:date>2016-07-11T00:03:00Z</dc:date>
    <item>
      <title>Displaying json data in HTML</title>
      <link>https://community.intel.com/t5/Software-Archive/Displaying-json-data-in-HTML/m-p/1120679#M75976</link>
      <description>&lt;P&gt;I am using PHP server to respond with my app in every request. This is the sample json data:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;[{
"id":"11",
"user_id":"8000",
"product":"Shoes A",
"quantity":"1",
"date_open":"2015-01-04",
"paid":"1",
"harvested":"",
"reinvest":null,
"profit":null,
"investment":"3000"
},

{
"id":"12",
"user_id":"8000",
"product":"Shoes B",
"quantity":"1",
"date_open":"2015-03-01",
"paid":"1",
"harvested":"",
"reinvest":null,
"profit":null,
"investment":"1500"
}]&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px; line-height: 19.5px;"&gt;The number of product per user here is different, some have no product, some have 1, 2...10 etc. products. So depending on how many the product of a user,&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="margin: 0px; padding: 0px; border: 0px; font-size: 15px; color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; line-height: 19.5px;"&gt;what is the best way displaying them in a table&lt;/STRONG&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px; line-height: 19.5px;"&gt;. So that the data/items are all organize and well displayed with image upon clicking the button.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px; line-height: 19.5px;"&gt;As of now this is my ajax request code.&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:xml;"&gt;$("button").click(function(){
        $.ajax({
            type: 'POST',
            url: "http://www.sample.com/app/user-data.php", 
            crossDomain: true,
            dataType: 'json',
            data: { user_token: user_token },
            success: function(data, status, jqXHR) {
                //console.log(data); //this is displaying as object why?
                //console.log(status);
                console.log(JSON.stringify(data)); //to string

            },
            error: function(xhr, ajaxOptions, thrownError) {
                alert(ajaxOptions + " " + thrownError);
            }

        });
    });&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 01:20:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Displaying-json-data-in-HTML/m-p/1120679#M75976</guid>
      <dc:creator>xkevin</dc:creator>
      <dc:date>2016-07-08T01:20:13Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Software-Archive/Displaying-json-data-in-HTML/m-p/1120680#M75977</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;What I usually did to show records like this is use listitems. They are well displayed on screen and you could show additional info where you click on one of it.&lt;/P&gt;

&lt;P&gt;Here is the code of one of my apps (a mix from yours and mine) and a sample screenshot. I'm using &lt;STRONG&gt;Bootstrap&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="screenshot_483.jpg"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/8946i22780A17776B0FBB/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="screenshot_483.jpg" alt="screenshot_483.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;$("button").click(function(){
        $.ajax({
            type: 'POST',
            url: "http://www.sample.com/app/user-data.php", 
            crossDomain: true,
            dataType: 'json',
            data: { user_token: user_token },
            success: function(data, status, jqXHR) {
       			
				//This is the listitems container, clear it before show result
				$("#lv_precios").empty();
				
				
				//Take this as pseudo code, I don't know if your returned JSON will work exactly as this
				//result is like your data JSON object
				
				//data records iteration
				for(var i = 0; i &amp;lt; result.rows.length; i++){
					//fill listitem structure with relevant data fields
					$("#lv_precios").append('&amp;lt;a class="list-group-item allow-badge widget uib_w_31" data-uib="twitter%20bootstrap/list_item" data-ver="1" href="javascript:editaPrecio(\''+result.rows&lt;I&gt;.id+'\');"&amp;gt;'
											+'&amp;lt;span class="badge glyphicon glyphicon-chevron-right"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;h4 class="list-group-item-heading"&amp;gt;'+result.rows&lt;I&gt;.value.fecha.substr(8,2)+'/'+result.rows&lt;I&gt;.value.fecha.substr(5,2)+'/'+result.rows&lt;I&gt;.value.fecha.substr(0,4)+': '+result.rows&lt;I&gt;.value.precio.toFixed(2)+' $/litro'
											+'&amp;lt;/h4&amp;gt;&amp;lt;p class="list-group-item-text"&amp;gt;'+result.rows&lt;I&gt;.value.litros+' litros - Pago: '+result.rows&lt;I&gt;.value.plazo+'&amp;lt;/p&amp;gt;&amp;lt;/a&amp;gt;');
				}
				///////////////
				
            },
            error: function(xhr, ajaxOptions, thrownError) {
                alert(ajaxOptions + " " + thrownError);
            }

        });
    });
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Diego&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 11:37:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Displaying-json-data-in-HTML/m-p/1120680#M75977</guid>
      <dc:creator>Diego_Calp</dc:creator>
      <dc:date>2016-07-08T11:37:00Z</dc:date>
    </item>
    <item>
      <title>Thank you, Diego!</title>
      <link>https://community.intel.com/t5/Software-Archive/Displaying-json-data-in-HTML/m-p/1120681#M75978</link>
      <description>&lt;P&gt;Thank you, Diego!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 00:03:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Displaying-json-data-in-HTML/m-p/1120681#M75978</guid>
      <dc:creator>xkevin</dc:creator>
      <dc:date>2016-07-11T00:03:00Z</dc:date>
    </item>
  </channel>
</rss>

