Doing synchronous JSON on rails

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

  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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs