title: $.ajax Call to ColdFusion Component Outputs Text Not HTML
body: <p>I apologize in advance if this was already answered.</p>
  
  <p>My goal is to create a pagination scheme that sends variables to a query in a ColdFusion function that grabs X number of elements and displays those records on my web page without refreshing it.  So in an attempt to test the basic function of grabbing HTML content and displaying it to the screen without refreshing, I am trying to execute a simple AJAX call to a ColdFusion component, having it return a variable with HTML content, and display the formatted HTML inside a div tag on my web page.  This is based on a previous example I saw on the web where it used a cfajaxproxy instead, and while that could be my problem, I'm amazed that it's simply not doing what it's supposed to.</p>
  
  <p>I have a file called testGeneration.cfm and here is the code:</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
      &lt;title&gt;Untitled Document&lt;/title&gt;
  
      &lt;!-- call the jQuery library --&gt;
      &lt;script src="jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
          $(document).ready(function() {
              $("#loadLink").click(function(e) {
                  e.preventDefault();
                  $.ajax({
                      type: "GET",
                      url: "generateInfo.cfc?method=createHTML",
                      dataType: "html",
                      success: function(message) {
                          $("#mydiv").html(message);
                      }
                  });
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;a href="" id="loadLink"&gt;Load Query&lt;/a&gt;
      &lt;!-- empty div to load dynamcically generated table into --&gt;
      &lt;div id="mydiv"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>As you can see it calls the component GenerateInfo with the method CreateHTML.  Here is the code for generateInfo.cfc:</p>
  
  <pre><code>&lt;cfcomponent displayname="Generate HTML" output="false"&gt;
  
  &lt;cffunction name="createHTML" displayname="Create HTML" description="Creates HTML to output with jQuery." access="remote" output="false" returntype="string"&gt;
  
      &lt;!--- SET VARIABLE TO RETURN ---&gt;
      &lt;cfset VARIABLES.html = ""&gt;
  
      &lt;!--- SAVE CONTENT ---&gt;
  
      &lt;cfsavecontent variable="VARIABLES.html"&gt;
      &lt;strong&gt;hello world&lt;/strong&gt;
      &lt;/cfsavecontent&gt;
      &lt;!--- RETURN SAVED CONTENT ---&gt;
      &lt;cfreturn VARIABLES.html&gt;
  
  &lt;/cffunction&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now, when I click the hyperlink, it should display the content as</p>
  
  <p><strong>hello world</strong></p>
  
  <p>Instead, it displays the content as</p>
  
  <p>&lt;strong&gt;hello world&lt;/strong&gt;</p>
  
  <p>What am I doing wrong?  How do I get it to process the HTML being sent back as a return variable in a coldfusion component function?</p>
  
  <p>Tony</p>