I am sending an object through ajax, using the following hash:
container = { "client" => client, "status" => "success"}
render :json => container.to_json
The client
is an object with token and password.
I can't change the javascript, it asks for the response in this shape:
$.ajax({
{...}
},
success: function(data) {
if (data.status == "success") { ... < do things with data.client >
I was trying to use:
container = { "client" => client.to_json(:only => [ :id, :first_name, :last_name, :address, :phone]), "status" => "success"}
render :json => container.to_json
But so the second .to_json
handle the first as a string and wraps it between quotes.
Could someone has some idea to help me?
Thank you very much.