title: displaying an ajax response with jquery
body: <p>I have a Coldfusion cfc that queries a database for data. I would like to call that cfc and display the ajax response within a div. Eventually I would like to format the response with html. Currently I am having trouble with displaying the response. This is what I have so far.</p>
  
  <p>Here is the cfc : <strong>Asset.cfc</strong></p>
  
  <pre><code>&lt;cffunction name="Asset" access="remote" returntype="array"&gt;
          &lt;cfargument name="asset_id" type="string" required="yes"&gt;
  
           &lt;!--- Define the local scope. ---&gt;
            &lt;cfset var LOCAL = {} /&gt;    
            &lt;cfset var qPics = "" /&gt;
            &lt;cfset var result = arrayNew(1) /&gt;
            &lt;cfset var PicStruct  = '' /&gt;
  
          &lt;cfquery name="Pics"&gt;
          SELECT DISTINCT aq.ID
          FROM AAssignment a 
          INNER JOIN Assets aq ON aq.ID = a.Asset
          WHERE a.AssetItem = &lt;cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.assetgrp_id#"&gt;                
          &lt;/cfquery&gt;
  
           &lt;cfloop query="Pics"&gt;
              &lt;cfset PicStruct = StructNew() /&gt;
              &lt;cfset PicStruct["value"] = ID /&gt;
              &lt;cfset ArrayAppend(result,PicStruct) /&gt;
            &lt;/cfloop&gt;
  
          &lt;cfset myResult="#result#"&gt;
          &lt;cfreturn myResult&gt;
      &lt;/cffunction&gt;
  </code></pre>
  
  <p>Here is the jquery </p>
  
  <pre><code>   &lt;script&gt;
      var caseid = &lt;cfoutput&gt;'#URL.ID#'&lt;/cfoutput&gt;
  
      $.ajax({
            type:'GET',
            url:'Asset.cfc?method=Asset&amp;returnformat=json',
            dataType: "json",
            data: {
                asset_id:     caseid,
              },
            success:function(data) {
              if(data) {   // DO SOMETHING     
                  $('#picoutput').html(data);
              } else { // DO SOMETHING }
            }
          }
         });
      &lt;/script&gt;
  
  &lt;div id="picoutput"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Right now I get this response back from the cfc in Firebug.</p>
  
  <pre><code>[{"value":"3277C2B9-155D-D714-40143A59A8290252"}]
  </code></pre>
  
  <p>However it will not display in the div.</p>