How do I return JSON from an action in CFWheels?

I've been reading a lot about returning JSON in all looks straight forward, but all I ever get is a blank page with no JSON returned. I may be doing something really obviously wrong here.

Here's my action:

public void function ajax() { 

    param name="params.keyword" default="";


    pins = model("pin").findAll(

        include     = "user", 
        order       = "createdat DESC",
        where       = "title LIKE '%#cleanInput(application.jsoup, params.keyword)#%'"


    renderWith(data=pins, layout=false);


I can confirm that searching on a word and dumping the query result reveals a record, but when it's like above, all I get is a blank screen. Am I missing something here?

I want to return the query object in JSON. Is there something I have to actually output in my view? I could do this, but wante to do it all from the action as I thought it would?

Thanks, Mikey.


Just off the top of my head are you passing Format=JSON in your ajax call? If not the controller will not return JSON.

Need Your Help

About Java HashMap: when key is a Set<Integer>

java hashmap set

I have a toCopy HashMap that's of the form HashMap&lt;String, Set&lt;Integer&gt;&gt;. The key of toCopy is a string consists of two numbers, like "01" or "10".

Telerik RadButton with ContentTemplate not showing radio button telerik

I've created two radio buttons with the following code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.