So I have found how to generate json in a rails app in the wiki
(Peak Obsession), what I have
yet to figure out is how to make a synchronous call via json to rails so
that I can block while fetching the information from a user request.
context:
I have used JSON on top of java in the past, and in order to make
synchronous calls I had to do the following:
-
include json.js
-
add the json object to the page:
<jsp:useBean id=“JSONRPCBridge” scope="session
class=“com.metaparadigm.jsonrpc.JSONRPCBridge” /> -
in the jsp, register a json object as an object that can be called
from the javascript of the page<% JSONRPCBridge.registerObject(“myTestObject”, aTestObject); %>
-
Register the JSON Servlet
-
Then call the function either async:
jsonrpc.myTestObject.myFunction(myCallBack, “hello”);
or sync:
var result = jsonrpc.myTestObject.myFunction("hello");
alert(result);
I would like to know how I would go about getting to #5 in rails and
Peak Obsession really only
explains the actual writing out of the JSON object.
Thanks,
Devon Jones