Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing content of JSON result and 'undefined' in a grid
    primarykey
    data
    text
    <p>So, I'm using JQuery to read a JSON and put it inside a grid. Problem is : the grid won't show when the JSON is :</p> <pre><code>{"result":[[{"type":"VOMesas.TMesas","id":1,"fields":{ "FUsers":1,"FEnclosing":0,"FClientName":"","FCode":100,"FStatus":1,"FTotalValue":128.25}}]]} </code></pre> <p>But if the JSON is like that, without the field:{...} :</p> <pre><code>{"result":[[{"type":"VOMesas.TMesas","id":1,"FUsers":1,"FEnclosing":0,"FClientName":"","FCode":100,"FStatus":1,"FTotalValue":128.25}]]} </code></pre> <p>It reads.</p> <p>Here is the function I'm using: </p> <pre><code>function getContent(order) { $.getJSON("query.json", function(data) { $.each(data.result, function(i, item) { var grid = '&lt;table border="1"&gt;'; var i=0; var CAMPO; for (i=0; i &lt; item.length; i++){ CAMPO = item[i]; grid += '&lt;tr&gt;&lt;td&gt;'+ CAMPO.FQtdPessoas + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FDataFechamento + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FTempoPermanencia + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FNomeCliente + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FValorAcrescimo + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FValorDesconto + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FValorServico + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FDataAbertura + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FNumero + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FStatus + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FValorTotal + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FTerminalAberto + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FNumeroVenda + '&lt;/td&gt;&lt;td&gt;'+ CAMPO.FGarcon + '&lt;/td&gt;&lt;/tr&gt;'; } grid += '&lt;/table&gt;'; $("#dvContent").html(grid); $("#dvContent").find("a").click(function(e){ var link = $(this); getContent(link.html()); }); }); }); } $(document).ready(function(){ $(function() { getContent(); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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