I am trying to make a jQuery get() AJAX call, but the response is just white space. It’s not empty, but a series of blank lines, and what appears to be spaces and tabs. Here is the 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 “text” inside, which, as I said before, appears to be blank lines, spaces and tabs. If I query the database in a static way, I am able to access the data as expected.
I don’t think this is a cross-domain issue, unless it’s because I’m calling jQuery from Google’s code CDN.
Thanks for your help.
You’re not outputting anything, you’re just making a query.
Try this after the query: