JQuery get () AJAX only returns spaces

I'm trying to make a jQuery get () AJAX call, but the answer is just a blank. It's not empty, but a series of empty lines and what appears to be spaces and tabs. Here is jQuery:

$("#package-list a").click(function(event){
  event.preventDefault();
  var packageID = this.hash.split("#")[1];  //Get the package ID from the link hash, then split off the hash.
  $.get(
    "key-ajax.cfm",
    {n:packageID},   //parameters
    function(data){  //callback
      alert(data);
    }
  );
});

      

And here is the ColdFusion call to the database (key-ajax.cfm):

<cfprocessingdirective pageEncoding="utf-8">
<cfquery name="treePackages" datasource="#application.dsn#">
  SELECT id, dateCreated, n, name, fileName, sizeKB
    , product1Name, product1Link, product2Name, product2Link, product3Name, product3Link
  FROM ref_color_keys
  WHERE n = #url.n#
</cfquery>

      

When the response comes back, it looks like an empty box, but I can select the "text" inside, which, as I said, is empty lines, spaces and tabs. If I query the database in a static way, I can access the data as expected.

I don't think this is a cross-domain issue, if only because I am calling jQuery from Google CDN code.

Thank you for your help.

+3


source to share


1 answer


You don't output anything, you just make a request.

Try this after asking:



<cfoutput>#serializeJson(treePackages)#</cfoutput>

      

+3


source







All Articles