<?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: Parse json data into coldfusion code</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/parse-json-data-into-coldfusion-code</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/parse-json-data-into-coldfusion-code/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>gena_mak on Parse json data into coldfusion code</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/parse-json-data-into-coldfusion-code#p28175</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/parse-json-data-into-coldfusion-code#p28175</guid>
        	        	<description><![CDATA[<p>Hi</p>
<p>I am working on generating a report with data in JSON format.  Here is the action file that receives parameters and displays either  html table with data or excel. I need help with parsing JSON data I am  getting into required format (html or excel).  I know how to work with excel formatting, I just need help with parsing  JSON data and outputing it. I someone help me to complete the code, the part where it is passed from jquery to coldfusion. Any help is greatly appreciated.</p>
<p>Thank you</p>
</p>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit1393' value='Select Code' data-codeid='sfcode1393' /></p><div class='sfcode' id='sfcode1393'>&#60;cfajaxproxy cfc=&#34;components.acct.accttrx&#34;&#62;
&#60;script src=&#34;../jQuery/js/jquery-1.7.2.min.js&#34;&#62;&#60;/script&#62;

&#60;cfparam name=&#34;prD&#34; default=&#34;0_0&#34;&#62;
&#60;cfparam name=&#34;sM&#34; default=&#34;1&#34;&#62;
&#60;cfparam name=&#34;sY&#34; default=&#34;2013&#34;&#62;
&#60;cfparam name=&#34;status&#34; default=&#34;0&#34;&#62;
&#60;cfparam name=&#34;FORM.fileformat&#34; default=&#34;html&#34;&#62;

&#60;script type=&#34;text/javascript&#34;&#62;
  jQuery(document).ready(function(){        
    var myURL = &#39;../components/acct/accttrx.cfc&#39;;

  function populateReport(){            
  $.ajax({
  url: myURL + &#34;?method=GetTranactions&#34;,
  type: &#39;POST&#39;,
  data: { 
    prID: &#39;&#60;cfoutput&#62;#prD#&#60;/cfoutput&#62;&#39;,
    mn: &#39;&#60;cfoutput&#62;#sM#&#60;/cfoutput&#62;&#39;,
    yr: &#39;&#60;cfoutput&#62;#sY#&#60;/cfoutput&#62;&#39;,
    st: &#39;&#60;cfoutput&#62;#status#&#60;/cfoutput&#62;&#39;,
    ea_adm:&#39;1&#39;,
    slist:&#39;&#39;,
    lang: &#39;1&#39;
  },
  dataType: &#34;json&#34;,
  success: 
    function(data){
    $.each(data, function(index, item) {
      //(item.description,item.balance,item.accttrx_status);
      // I need help from this point to pass 
      // data to cfml part of my code
      });
    },
  error: 
    function(){
      alert(&#34;An error has occurred while fetching records&#34;);
    }
});
populateReport();
});
&#60;/script&#62;
&#60;/HEAD&#62;
&#60;body&#62;
&#60;cfif FORM.fileformat Eq &#39;excel&#39;&#62;
    &#60;cfset VARIABLES.vcFilename = &#34;thisreport_&#34; &#38; DateFormat(Now(), &#34;yyyymmdd&#34;) &#38; &#34;-&#34; &#38;  TimeFormat(Now(), &#34;HHmmss&#34;) &#38; &#34;.xls&#34;&#62;
    &#60;cfsetting enablecfoutputonly=&#34;Yes&#34;&#62;
    &#60;cfcontent type=&#34;application/vnd.ms-excel&#34;&#62;
    &#60;cfheader name=&#34;Content-Disposition&#34; value=&#34;inline;filename=&#34;&#34;#VARIABLES.vcFilename#&#34;&#34;&#34;&#62;

     &#60;cfoutput&#62;
      &#60;!--- here display data from JSON object ---&#62;
     &#60;/cfoutput&#62;
  &#60;cfsetting enablecfoutputonly=&#34;No&#34;&#62;
  &#60;cfelse&#62;
    &#60;div id=&#34;reportcontents&#34; /&#62;  &#60;!--- display row html ---&#62;
&#60;/cfif&#62;<br /><br /><br /></div><br />Below is the Response:<br /><br /></pre>
<pre class="default prettyprint prettyprinted">{"ROWS":[<br />&#160; {<br />&#160;&#160; "balance":-642.04000,<br />&#160;&#160; "description":"ABC Company",<br />&#160;&#160; "ee_name":"Jon, Doe",<br />&#160;&#160; "plan_id":0,<br />&#160;&#160; "debit":25000.22000,<br />&#160;&#160; "accttrx_year":2013,<br />&#160;&#160; "sponsor_id":5,<br />&#160;&#160; "division_id":0,<br />&#160;&#160; "accttrx_month":1,<br />&#160;&#160; "credit":26591.25000,<br />&#160;&#160; "trx_employee_id":1,<br />&#160;&#160; "cheque_amt":25000.00000,<br />&#160;&#160; "cheque_no":"",<br />&#160;&#160; "accttrx_status":"B",<br />&#160;&#160; "accttrx_id":15<br />&#160; },<br />&#160; {<br />&#160;&#160; "balance":-642.04000,<br />&#160;&#160; "description":"ABC Company",<br />&#160;&#160; "ee_name":"James, Done",<br />&#160;&#160; "plan_id":0,<br />&#160;&#160; "debit":32233.07000,<br />&#160;&#160; "accttrx_year":2013,<br />&#160;&#160; "sponsor_id":5,<br />&#160;&#160; "division_id":0,<br />&#160;&#160; "accttrx_month":1,<br />&#160;&#160; "credit":30000.00000,<br />&#160;&#160; "trx_employee_id":1,<br />&#160;&#160; "cheque_amt":32233.07000,<br />&#160;&#160; "cheque_no":"",<br />&#160;&#160; "accttrx_status":"P",<br />&#160;&#160; "accttrx_id":14<br />&#160; }<br />&#160; ],<br />&#160; "PAGE":1,<br />&#160; "RECORDS":2,<br />&#160; "TOTAL":1.0<br />}</pre>
]]></description>
        	        	<pubDate>Wed, 30 Jan 2013 16:10:55 +0200</pubDate>
        </item>
</channel>
</rss>