Question

I've been reading a lot about returning JSON in CFWheels...it 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="";

    onlyProvides("json");

    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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top