<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Not populating JSON data</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Wakie on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18466</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18466</guid>
        	        	<description><![CDATA[<p>Hi Reg, thanks for your reply.</p>
</p>
<p>Unfortunately your tip made no difference - my JSON now looks like this:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4115' value='Select Code' data-codeid='sfcode4115' /></p>
<div class='sfcode' id='sfcode4115'>{&#34;page&#34;:&#34;1&#34;,&#34;total&#34;:&#34;100&#34;,&#34;records&#34;:&#34;1&#34;,&#34;rows&#34;:[{&#34;id&#34;:&#34;200&#34;,&#34;cell&#34;:[&#34;200&#34;,&#34;111&#34;,&#34;test&#34;,&#34;664.3&#34;,&#34;144&#34;,&#34;900&#34;,&#34;yay&#34;]}]}</div>
</p>
<p>Regards</p>
<p>Wakie</p>
]]></description>
        	        	<pubDate>Thu, 08 Jul 2010 05:25:57 +0300</pubDate>
        </item>
        <item>
        	<title>Reg on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18462</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18462</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>This may be a red herring, but I got burned on something similar to this today, until I found the following note in the jQuery site:</p>
<p style="padding-left: 30px;">&#160;Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript&#39;s object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes.</p>
<p>I notice that not all of&#160;the data returned in your json string is enclosed in double quotes. You might wnat to try changing that to see if it makes any difference (even the numbers).&#160;</p>
<p>HTH</p>
<p>Reg</p>
]]></description>
        	        	<pubDate>Wed, 07 Jul 2010 20:13:07 +0300</pubDate>
        </item>
        <item>
        	<title>Wakie on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18461</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18461</guid>
        	        	<description><![CDATA[<p>Database connectivity is fine, it returns the JSON output in my first post. I&#39;m pretty concerned that even the provided examples don&#39;t work...</p>
]]></description>
        	        	<pubDate>Wed, 07 Jul 2010 19:51:19 +0300</pubDate>
        </item>
        <item>
        	<title>churd on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18459</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18459</guid>
        	        	<description><![CDATA[<p>Is it pulling up a blank table, or no table at all?</p>
]]></description>
        	        	<pubDate>Wed, 07 Jul 2010 19:26:57 +0300</pubDate>
        </item>
        <item>
        	<title>churd on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18458</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18458</guid>
        	        	<description><![CDATA[<p>Not sure I&#39;ll be able to help you, but my issue was in the $db portion...</p>
<p>Are you sure that the following allows you proper access to your database?</p>
<p>$db = mysql_connect(&#39;localhost&#39;, &#39;root&#39;, &#39;&#39;)</p>
]]></description>
        	        	<pubDate>Wed, 07 Jul 2010 19:24:29 +0300</pubDate>
        </item>
        <item>
        	<title>Wakie on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18456</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18456</guid>
        	        	<description><![CDATA[<p>Hi churd,</p>
</p>
<p>It&#39;s essentially a hacked up version of the demo PHP script, but here it is anyway:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8989' value='Select Code' data-codeid='sfcode8989' /></p>
<div class='sfcode' id='sfcode8989'>&#60;?php<br />$page = 1;//$_GET[&#39;page&#39;]; // get the requested page<br />$limit = $_GET[&#39;rows&#39;]; // get how many rows we want to have into the grid<br />$sidx = $_GET[&#39;sidx&#39;]; // get index row - i.e. user click to sort<br />$sord = $_GET[&#39;sord&#39;]; // get the direction<br />if(!$sidx) $sidx =1;<br />// connect to the database<br />$db = mysql_connect(&#39;localhost&#39;, &#39;root&#39;, &#39;&#39;)<br />or die(&#34;Connection Error: &#34; . mysql_error());</p>
<p>mysql_select_db(&#39;fone_site&#39;) or die(&#34;Error conecting to db.&#34;);<br />$result = mysql_query(&#34;SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id&#34;);<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];</p>
<p>if( $count &#62;0 ) {<br />&#160;&#160; &#160;$total_pages = 100;//ceil($count/$limit);<br />} else {<br />&#160;&#160; &#160;$total_pages = 0;<br />}<br />if ($page &#62; $total_pages) $page=$total_pages;<br />$start = $limit*$page - $limit; // do not put $limit*($page - 1)<br />$SQL = &#34;SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id&#34;;<br />$result = mysql_query( $SQL ) or die(&#34;Couldn t execute query.&#34;.mysql_error());</p>
<p>$responce-&#62;page = $page;<br />$responce-&#62;total = $total_pages;<br />$responce-&#62;records = $count;<br />$i=0;<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;id&#39;]=$row[id];<br />&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;cell&#39;]=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]);<br />&#160;&#160;&#160; $i++;<br />}&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />echo json_encode($responce);<br />?&#62;</p>
</div>
]]></description>
        	        	<pubDate>Wed, 07 Jul 2010 19:08:35 +0300</pubDate>
        </item>
        <item>
        	<title>churd on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18453</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18453</guid>
        	        	<description><![CDATA[<p>I had a super hard time getting JSON data to populate... it ended up being the way that it was connecting to the database.</p>
<p>Assuming that your files are setup properly on the server (I made sure mine were by manually populating the data without any JSON or XML calls)... what I did was replace the "dbconfig.php" call with my own connection document, and then replace the "$db = " in my server.php file with my own connection item.</p>
<p>Any chance you could paste your entire server.php file? (excluding your login info, of course).&#160;</p>
]]></description>
        	        	<pubDate>Wed, 07 Jul 2010 18:33:16 +0300</pubDate>
        </item>
        <item>
        	<title>Wakie on Not populating JSON data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18452</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/not-populating-json-data#p18452</guid>
        	        	<description><![CDATA[<p>Hi all,</p>
</p>
<p>I&#39;ve been trying to debug this for ages with no success, hopefully someone can point me in the right direction.</p>
</p>
<p>I&#39;m trying to replicate one of the examples in the documentation but can&#39;t get it to work. Here&#39;s my client-code:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8708' value='Select Code' data-codeid='sfcode8708' /></p>
<div class='sfcode' id='sfcode8708'>
<p>&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;<a href=&#34;/blog/&#34;http:/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#34; target=&#34;_blank&#34; target="_blank"></a><a href="http://www.w3.org/TR/xhtml1/DT" rel="nofollow" target="_blank">http://www.w3.org/TR/xhtml1/DT</a>.....tional.dtd&#34;&#62;<br />&#60;html xmlns=&#34;<a href=&#34;/blog/&#34;http:/www.w3.org/1999/xhtml&#34;&#34; target=&#34;_blank&#34; target="_blank">http://www.w3.org/1999/xhtml</a>&#34;&#62;<br />&#60;head&#62;<br />&#60;script src=&#34;includes/classes/jqgrid/js/jquery-1.4.2.min.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62;<br />&#60;script src=&#34;includes/classes/jqgrid/js/i18n/grid.locale-en.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62;</p>
<p>&#60;script src=&#34;includes/classes/jqgrid/js/jquery.jqGrid.min.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62;</p>
<p>&#60;link type=&#34;text/css&#34; href=&#34;/sandbox/css/dark-hive/jquery-ui-1.8.custom.css&#34; rel=&#34;stylesheet&#34; /&#62;<br />&#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; media=&#34;screen&#34; href=&#34;includes/classes/jqgrid/css/ui.jqgrid.css&#34; /&#62;<br />&#160;<br />&#60;style&#62;<br />html, body {<br />&#160;margin: 0;<br />&#160;padding: 0;<br />&#160;font-size: 75%;<br />}<br />&#60;/style&#62;<br />&#60;script type=&#34;text/javascript&#34;&#62; <br />jQuery().ready(function (){<br />jQuery(&#34;#list2&#34;).jqGrid({<br />&#160;&#160; &#160;<a href=&#34;/blog/&#34;/blog/&#39;server.php?q=2&#39;&#34;&#34; target=&#34;_blank&#34; target="_blank">url:&#39;server.php?q=2&#39;</a>,<br />&#160;datatype: &#34;json&#34;,<br />&#160;&#160; &#160;colNames:[&#39;Inv No&#39;,&#39;Date&#39;, &#39;Client&#39;, &#39;Amount&#39;,&#39;Tax&#39;,&#39;Total&#39;,&#39;Notes&#39;],<br />&#160;&#160; &#160;colModel:[<br />&#160;&#160; &#160;&#160;{name:&#39;id&#39;,index:&#39;id&#39;, width:55},<br />&#160;&#160; &#160;&#160;{name:&#39;invdate&#39;,index:&#39;invdate&#39;, width:90},<br />&#160;&#160; &#160;&#160;{name:&#39;name&#39;,index:&#39;name asc, invdate&#39;, width:100},<br />&#160;&#160; &#160;&#160;{name:&#39;amount&#39;,index:&#39;amount&#39;, width:80, align:&#34;right&#34;},<br />&#160;&#160; &#160;&#160;{name:&#39;tax&#39;,index:&#39;tax&#39;, width:80, align:&#34;right&#34;},&#160;&#160;<br />&#160;&#160; &#160;&#160;{name:&#39;total&#39;,index:&#39;total&#39;, width:80,align:&#34;right&#34;},&#160;&#160;<br />&#160;&#160; &#160;&#160;{name:&#39;note&#39;,index:&#39;note&#39;, width:150, sortable:false}&#160;&#160;<br />&#160;&#160; &#160;],<br />&#160;&#160; &#160;rowNum:10,<br />&#160;&#160; &#160;rowList:[10,20,30],<br />&#160;&#160; &#160;pager: &#39;#pager2&#39;,<br />&#160;&#160; &#160;sortname: &#39;id&#39;,<br />&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160; sortorder: &#34;desc&#34;,<br />&#160;&#160;&#160; caption:&#34;JSON Example&#34;<br />});<br />jQuery(&#34;#list2&#34;).jqGrid(&#39;navGrid&#39;,&#39;#pager2&#39;,{edit:false,add:false,del:false});<br />});<br />&#60;/script&#62;</p>
<p>&#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62;<br />&#60;title&#62;Untitled Document&#60;/title&#62;</p>
<p>&#60;table id=&#34;list2&#34;&#62;&#60;/table&#62;<br />&#60;div id=&#34;pager2&#34;&#62;&#60;/div&#62;</p>
<p>&#60;/body&#62;<br />&#60;/html&#62;</p>
</div>
<p>JSON data looks like this:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8071' value='Select Code' data-codeid='sfcode8071' /></p>
<div class='sfcode' id='sfcode8071'>
<p>{&#34;page&#34;:1,&#34;total&#34;:100,&#34;records&#34;:&#34;1&#34;,&#34;rows&#34;:[{&#34;id&#34;:&#34;200&#34;,&#34;cell&#34;:[&#34;200&#34;,&#34;111&#34;,&#34;test&#34;,&#34;664.3&#34;,&#34;144&#34;,&#34;900&#34;,&#34;yay&#34;]}]}</p>
</div>
<p>Any tips would be appreciated.</p>
</p>
<p>Thanks,</p>
<p>Wakie.</p>
]]></description>
        	        	<pubDate>Wed, 07 Jul 2010 18:21:29 +0300</pubDate>
        </item>
</channel>
</rss>