英文:
FW/1 How to return ajax data without view?
问题
我有以下的函数,它返回rc.employee
。我从模型的索引页面调用这个函数checkempid
。我是在onblur
时触发它运行。我只想要数据返回,但是FW1似乎在我的div
内再次渲染整个页面。如何只返回数据而不是整个页面/视图?
public any function checkempid(struct rc = {}) {
var employeeid = rc.employeeid;
rc.employee = variables.activeidentificationService.checkempid(employeeid);
}
英文:
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);
}
答案1
得分: 1
我建议使用发送JSON响应,并使用这里的答案。
在您的情况下,因为您没有返回纯文本,您可以使用以下方式。
public any function checkempid(struct rc = {}) {
var employeeid = rc.employeeid;
rc.employee = variables.activeidentificationService.checkempid(employeeid);
variables.fw.renderData("text", rc.employee);
}
英文:
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);
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论