coldfusionfw1

FW/1 How to return ajax data without view?


I have the following function that returns rc.employee. I am calling this function checkempid from the index page of a model. I am triggering this to run onblur. I only want the data to come back, but FW1 seems to be rendering the entire page again inside my div. How can I only return the data and not the entire page/view?

public any function checkempid(struct rc = {}) {
    var employeeid = rc.employeeid;
    rc.employee = variables.activeidentificationService.checkempid(employeeid);
    
}   

Solution

  • I would suggest using sending a JSON response and use the answer here.

    In your case since you are not returning a plain text you can use the following.

    public any function checkempid(struct rc = {}) {
        var employeeid = rc.employeeid;
        rc.employee = variables.activeidentificationService.checkempid(employeeid);
        variables.fw.renderData( "text", rc.employee);
    }