Whatever message this page gives is out now! Go check it out!
ColdFusion.JSON.decode(string) |
Parameter | Description |
string | The string to encode. |
<cfajaxproxy cfc="echo">
<cfajaximport>
<html>
<head>
<script>
function callme()
{
var e = new echo();
e.setReturnFormat('plain');
var args = {a:"Hello again!"};
var argsJSON = ColdFusion.JSON.encode(args);
var json = e.plainEcho(argsJSON);
var o = ColdFusion.JSON.decode(json);
alert(o.A);
}
</script>
</head>
<body>
<a href="javascript:callme()">Call</a>
</body>
</html><cfcomponent output="false">
<cffunction name="echo" access="remote">
<cfargument name="text">
<cfset var ret = StructNew()>
<cfset ret.a = text>
<cfreturn ret>
</cffunction>
<cffunction name="plainEcho" access="remote">
<cfargument name="text">
<cfset t = deserializeJSON(text)>
<cfset ret = echo(t.A)>
<cfreturn serializeJSON(ret)>
</cffunction>
</cfcomponent>