nikhil rn wrote in post #1101054: > I am making an ajax call to my controller. Controller is sending in the > response in an instance variable(as a json object). How can I access the > same in my ajax javascript? > > $(document).ready(function(){ > var currentCellText; > $(".inline").click(function() { > currentCellText = $(this).text(); > $.ajax({ > type: 'GET', > dataType: "json", > url:'/test', > async: false, > data:{ foo1:currentCellText > }, > dataType: "json", > success:function(data){ > alert('<%= @response %>'); > }, > error:function(data){ > alert("Error"); > } > }); > }); > }); > > I am getting an empty square bracket as my output. I am not able to find > out where I am wrong. Please guide me through.
Have you confirmed for certain that your action method is returning the JSON you expect? $ curl http://localhost:3000/test.json -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.