如何从FW/1中的操作返回JSON?

Jam*_*ler 1 coldfusion json fw1

如果需要JSON数据,FW/1似乎是面向返回完整的网页?典型布局如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
   <title>User Manager</title>
   <link rel="stylesheet" type="text/css" href="assets/css/styles.css" />
</head>
<body>


<h1>User Manager</h1>

<ul class="nav horizontal clear">
<li><a href="index.cfm">Home</a></li>
<li><a href="index.cfm?action=user.list" title="View the list of users">Users</a></li>
<li><a href="index.cfm?action=user.form" title="Fill out form to add new user">Add User</a></li>
<li><a href="index.cfm?reload=true" title="Resets framework cache">Reload</a></li>
</ul>

<br />

<div id="primary">
    <cfoutput>#body#</cfoutput>
</div>

</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

Sea*_*eld 7

从FW/1 2.2开始,您可以致电:

variables.fw.renderData( "json", result );
Run Code Online (Sandbox Code Playgroud)

在你的控制器中它会做你想要的.