5 Replies Latest reply on Jul 27, 2012 12:40 AM by Bhakta Ranjan Satapathy

    Calling Ruby Via Ajax through Hybrid App

      I am having trouble getting the ajax code to call the ruby when running on the ET1 device but it does work on the RhoSimulator.  Are they any special settings that need to be in order for this to work on the actual device?


      The data object that comes back in the request is absolutely unreadable as well.  The only way I can get a return string from ruby is to call a JavaScript function and pass it on.  Is this the only way to get something back?


      Below is the code snippets of what I am trying to do:

      Version of RhoElements.


      Ruby Code

      def ReturnString


          return "Good"



        def getDeviceName

          return System.get_property('device_name')



      JavaScript Code


                                    beforeSend: function (xhrObj) {

                     alert("Sending Return String")


                  url: "/app/Test/ReturnString",

                                      type: "GET",

                                      cache: false,

                                      async: false,

                                      success: function(data)


                              alert("DeviceName " + GlobalData);

                              alert("Data " + data);




      function setGlobalData(Data){


      GlobalData = Data;