Displaying 20 results from an estimated 50000 matches similar to: "Rails and JSON example?"
2010 Jun 08
8
rails, ajax, json, and script
Could someone please demonstrate the code to send both json (or xml) AND
javascript (to be executed) in a single Ajax request?
Is this even possible?
--
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 post to this group, send email to
2010 Sep 26
1
Rails 3 basic Get JSON with jQuery and output on the page flow question
Rails newbie, thanks for help with this hopefully basic JSON type
question....
I have a model Books in my app, which belong_to users.
What''d I''d like to learn how to do, is use jQuery to get a JSON object
of the books that the user owns (current_user). And then use jQuery to
list the results out on a div (id=targetdiv).
Where I''m not certain, is this something Rails 3
2010 Nov 06
0
Rails and JQuery and Ajax/Json question
Hi,
I am using JQuery in my rails app. I''ve taken the approach outlined
in Ryan Bates''s Railscast on jquery to do the following:
jQuery.ajaxSetup({
''beforeSend'' : function(xhr) {xhr.setRequestHeader("Accept",
"text/javascript")}
});
to set my ajax call request Headers to text/javascript so that my
respond to block for javascript is
2012 Feb 20
1
respond_to format.json not being called
Hi all,
I''m submitting a form using jQuery, but in the respond_to block only the
format.html action is called.
This is the javascrip:
send_button.on(''click'', function(){
var form = $(this).closest(''.modal'').find(''form'');
$.post(''/messages'', form.serialize(),
function(data, status, xhr){
2010 Oct 31
0
Error in rendering json
Hello,
in my controller I use following code to render json.
render :json => @product, :callback => params[:callback]
I would expect (for example) following to be rendered:
callback({"name":"Computer","price":500})
Instead, it renders:
callback([{"name":"Computer","price":500}])
Notice the square brackets which disables
2011 Sep 06
8
Ajax and rails 3 UJS (jquery)
Hi, guys,
I''m in the midst of moving an app from rails 2.3.8 to rails 3.0.9.
Sadly, rails 3 no longer has javascript generators and I''m now forced
to do more javascript.
For my project, I have selected jQuery as the javascript framework for
my rails 3.0.9 app.
What I have done to have my app''s deletion link (for each item)
trigger an alert box when the deletion
2010 Sep 17
0
Key Value Json ActiveModel::Errors
Hi all,
I''m using Rails 3.0, and I have a model which validates if the
attribute :name is present. On my my views, I use Jquery to submit the
form which creates the model. If the name is not present, Rails
returns something like this Json:
[''Name is a required value'']
Is there a way to make it return something like this?
[''name'': ''Name is a
2013 Jul 19
0
Integrate jquery Grantt with my app in rails
Hi!
I made a app in rails and have registed somethings... i would integrate
jquery grantt with my app in rails.
https://github.com/robicch/jQueryGantt
Its is the project jqueryGrantt, he generate a json. I think that i could
build a JSON with rails and integrate with the grantt... but, how?
Thanks!
--
You received this message because you are subscribed to the Google Groups "Ruby on
2006 Apr 17
0
doing synchronous JSON on rails
So I have found how to generate json in a rails app in the wiki
(http://wiki.rubyonrails.com/rails/pages/HowtoGenerateJSON), 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
2012 Sep 18
4
"best practices" for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.
I''ve been writing a gem to implement and extend common controller
functionality so that Rails can be used with Javascript frameworks like
AngularJS (which we are using), Ember.js, etc. in such a way that the user
doesn''t have to tweak a a bunch of rails g controller boilerplate code to
provide services for use in these frameworks that in turn would require
various changes to
2013 May 27
6
Headache with Ajax in Rails using jQuery
Hello everyone, I''m a newbie at Ruby on Rails. I spent nearly two days
of the Memorial Day weekend stumbling upon making Ajax working in Rails.
At this point, I''m so exhausted and hope that I can get some help to
move forward. I have tried nearly everything I found on Google but
still not successful. Initially, I tried the Ajax approach offered by
Rails but did not work, so I
2011 Sep 19
1
Rails and UJS guide - not having much luck
I refered to http://railsdog.com/blog/2011/02/28/callbacks-in-jquery-ujs-in-rails3/
in hope of getting json data from my controller and displaying it in
my view when an ajax request is made.
I followed the instructions on the http://railsdog.com/blog/2011/02/28/callbacks-in-jquery-ujs-in-rails3/
and even corresponded with the author and also implemented his ''fix''
in
2013 Mar 11
8
Access instance variable in ajax rendered by controller - Rails
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?
This is my ajax call code:
$(document).ready(function(){
var currentCellText;
$(".inline").click(function() {
currentCellText = $(this).text();
$.ajax({
type: ''GET'',
dataType: "json",
2013 Jan 16
0
Rails 3.2 jQuery JSONP request not working - Moved Permanently
I am trying to send a POST request ( ''remove_tag_named'' )and getting a
simple OK back on success ; it doesn''t work..
the post is correctly sent , but after then it''s looping on sending a GET
request to the same url, with the error
301 Moved Permanently
I should not be far fro the solution, but I am stuck :
In my routes.rb
*namespace
2013 Jul 06
2
I thought Rails 3.2 ActionController automatically converts JSON params hashes...
Hey,
I was thinking I''d have my controllers do double-duty: the same actions
handling json and html requests differentially. For this, it''s useful that
Rails 3.2 automatic params hash conversion from json work (as described here<http://guides.rubyonrails.org/v3.2.13/action_controller_overview.html#json-xml-parameters>in the Rails docs). (I''m using ruby 1.9.2.)
2011 Sep 01
7
couldn't find file 'jquery' rails 3.1 stable mountable engine
When I create a new engine in Rails 3.1 stable and then access the dummy
app or the engine I get an error say that the app can''t find jquery.
I''ve created the engine using
rails plugin new coffee --mountable
I''ve also created a basic controller in the engine and the dummy app. If
I remove the javascript include tag, everything works. But with the tag
there it just
2010 Jun 24
0
Rails3: render_to_string of a .html.erb when request is a json request raises MissingTemplate error
I''ve the following situation (which actually works in Rails 2.3.8 and
this is a result of the migration of our app to rails3):
I have a partial which is rendered a few times (imagine tr''s in a
table). On the clientside there''s a script that does a json request
for a specific row (jQuery + ajax dataType: ''json'' and type: ''POST'')
In
2010 Dec 22
2
Rails - JSON object with an array?
Hello, I''m able to create and send a JSON object like so:
@mylist << {
:id => item.id,
:name => name.id
}
render :json => { :result => ''success'', :mylist => @mylist }
That works great. Problem I''m having now is that I need to include
users which can be 1 or users per item.
@mylist << {
2012 May 10
1
getting started with jQuery rails 3.2
Hi all,
I''m trying to work out how to get started using some jQuery in my rails
app.
rails -v = 3.2.2
ruby -v = 1.9.3-p194
I''m only sporadically a web-developer, and still quite inexperienced
with jQuery especially, so I may be making an obvious mistake.
Essentially, I''ve done very little after creating a new app, I''ve learnt
that jQuery is included by
2010 Jul 29
0
How does Rails respond to Ajax with JSON?
In Ruby on Rails, why
= render :json => array_data
shows nothing (as seen in Firebug, the GET in the console), but
- response.content_type = "application/json"
= render :text => array_data.to_json
shows the data array?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: