Reputation: 682
I get such javascript:
FB.api('/me', function(response) {
var name = response.name;
first_name = response.first_name;
alert("Name: "+ name + "\nFirst name: "+ first_name);}
How I could get value of name
and first_name
to rails controller?
I use Rails 3.2.
Upvotes: 0
Views: 166
Reputation:
Place the value of the javascript array in a request parameter, either via ajax or by setting the value of a form input. I'm going to use jQuery in my examples:
Option 1 (ajax):
$.post('/users/some_action', {"name" : name, "first_name", first_name})
Option 2 (setting a form):
$('#name').val(name)
$('#first_name').val(first_name)
In your controller:
name = params[:name]
first_name = params[:first_name]
Upvotes: 1