Forum: Ruby on Rails doing synchronous JSON on rails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Devon Jones (Guest)
on 2006-04-17 23:31
(Received via mailing list)
So I have found how to generate json in a rails app in the wiki
(, 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.

I have used JSON on top of java in the past, and in order to make
synchronous calls I had to do the following:
1) include json.js

	<script type="text/javascript" src="jsonrpc.js">
	<script type="text/javascript" src="myapp.js">

2) add the json object to the page:

	<jsp:useBean id="JSONRPCBridge" scope="session
class="com.metaparadigm.jsonrpc.JSONRPCBridge" />

3) in the jsp, register a json object as an object that can be called
from the javascript of the page

	<% JSONRPCBridge.registerObject("myTestObject", aTestObject); %>

4) Register the JSON Servlet
5)  Then call the function either async:

	jsonrpc.myTestObject.myFunction(myCallBack, "hello");

or sync:

        var result = jsonrpc.myTestObject.myFunction("hello");

I would like to know how I would go about getting to #5 in rails and really only
explains the actual writing out of the JSON object.

Devon Jones
This topic is locked and can not be replied to.