Hi guys,
I''m having a little bit of a problem. I have a controller method that
renders json:
render :json => current_member.to_json
This method is called in a js file using a simple get call. In firebug
I see that the response from the get call is a json string, as I
wanted it to be:
Object { created_at="2012-04-10T08:09:09Z", id=2385, member_id=820,
more...}
How do I make sense of this in JS? So far I have this...and it doesn''t
seem to be working:
response = $.get(''/members/check_shared_from_fb'');
in_json = $.parseJSON(response);
alert(in_json.to_sting);
The alert gives me null.
I hope I was clear. Thanks for all your help.
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On 10 April 2012 10:27, bertly_the_coder <muchira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi guys, > > I''m having a little bit of a problem. I have a controller method that > renders json: > render :json => current_member.to_json > > This method is called in a js file using a simple get call. In firebug > I see that the response from the get call is a json string, as I > wanted it to be: > Object { created_at="2012-04-10T08:09:09Z", id=2385, member_id=820, > more...} > > How do I make sense of this in JS? So far I have this...and it doesn''t > seem to be working: > response = $.get(''/members/check_shared_from_fb''); > in_json = $.parseJSON(response); > alert(in_json.to_sting);to_string might be better. Colin> > The alert gives me null. > > I hope I was clear. Thanks for all your help. > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- gplus.to/clanlaw -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hahaha! Colin, you are a funny guy, eh?
OK, That was a dumb mistake, this is what I get for mixing languages....for
anyone interested, the returned data is in the callback...duh! So the
response is in:
$.getJSON(''/members/check_shared_on_fb_or_twitter'',
function(response) {
//use response, the returned JSON here
});
On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder
wrote:>
> Hi guys,
>
> I''m having a little bit of a problem. I have a controller method
that
> renders json:
> render :json => current_member.to_json
>
> This method is called in a js file using a simple get call. In firebug
> I see that the response from the get call is a json string, as I
> wanted it to be:
> Object { created_at="2012-04-10T08:09:09Z", id=2385,
> member_id=820,
> more...}
>
> How do I make sense of this in JS? So far I have this...and it
doesn''t
> seem to be working:
> response = $.get(''/members/check_shared_from_fb'');
> in_json = $.parseJSON(response);
> alert(in_json.to_sting);
>
> The alert gives me null.
>
> I hope I was clear. Thanks for all your help.
On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder
wrote:>
> Hi guys,
>
> I''m having a little bit of a problem. I have a controller method
that
> renders json:
> render :json => current_member.to_json
>
> This method is called in a js file using a simple get call. In firebug
> I see that the response from the get call is a json string, as I
> wanted it to be:
> Object { created_at="2012-04-10T08:09:09Z", id=2385,
> member_id=820,
> more...}
>
> How do I make sense of this in JS? So far I have this...and it
doesn''t
> seem to be working:
> response = $.get(''/members/check_shared_from_fb'');
> in_json = $.parseJSON(response);
> alert(in_json.to_sting);
>
> The alert gives me null.
>
> I hope I was clear. Thanks for all your help.
On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder
wrote:>
> Hi guys,
>
> I''m having a little bit of a problem. I have a controller method
that
> renders json:
> render :json => current_member.to_json
>
> This method is called in a js file using a simple get call. In firebug
> I see that the response from the get call is a json string, as I
> wanted it to be:
> Object { created_at="2012-04-10T08:09:09Z", id=2385,
> member_id=820,
> more...}
>
> How do I make sense of this in JS? So far I have this...and it
doesn''t
> seem to be working:
> response = $.get(''/members/check_shared_from_fb'');
> in_json = $.parseJSON(response);
> alert(in_json.to_sting);
>
> The alert gives me null.
>
> I hope I was clear. Thanks for all your help.
On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder
wrote:>
> Hi guys,
>
> I''m having a little bit of a problem. I have a controller method
that
> renders json:
> render :json => current_member.to_json
>
> This method is called in a js file using a simple get call. In firebug
> I see that the response from the get call is a json string, as I
> wanted it to be:
> Object { created_at="2012-04-10T08:09:09Z", id=2385,
> member_id=820,
> more...}
>
> How do I make sense of this in JS? So far I have this...and it
doesn''t
> seem to be working:
> response = $.get(''/members/check_shared_from_fb'');
> in_json = $.parseJSON(response);
> alert(in_json.to_sting);
>
> The alert gives me null.
>
> I hope I was clear. Thanks for all your help.
On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder
wrote:>
> Hi guys,
>
> I''m having a little bit of a problem. I have a controller method
that
> renders json:
> render :json => current_member.to_json
>
> This method is called in a js file using a simple get call. In firebug
> I see that the response from the get call is a json string, as I
> wanted it to be:
> Object { created_at="2012-04-10T08:09:09Z", id=2385,
> member_id=820,
> more...}
>
> How do I make sense of this in JS? So far I have this...and it
doesn''t
> seem to be working:
> response = $.get(''/members/check_shared_from_fb'');
> in_json = $.parseJSON(response);
> alert(in_json.to_sting);
>
> The alert gives me null.
>
> I hope I was clear. Thanks for all your help.
On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder
wrote:>
> Hi guys,
>
> I''m having a little bit of a problem. I have a controller method
that
> renders json:
> render :json => current_member.to_json
>
> This method is called in a js file using a simple get call. In firebug
> I see that the response from the get call is a json string, as I
> wanted it to be:
> Object { created_at="2012-04-10T08:09:09Z", id=2385,
> member_id=820,
> more...}
>
> How do I make sense of this in JS? So far I have this...and it
doesn''t
> seem to be working:
> response = $.get(''/members/check_shared_from_fb'');
> in_json = $.parseJSON(response);
> alert(in_json.to_sting);
>
> The alert gives me null.
>
> I hope I was clear. Thanks for all your help.
On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder
wrote:>
> Hi guys,
>
> I''m having a little bit of a problem. I have a controller method
that
> renders json:
> render :json => current_member.to_json
>
> This method is called in a js file using a simple get call. In firebug
> I see that the response from the get call is a json string, as I
> wanted it to be:
> Object { created_at="2012-04-10T08:09:09Z", id=2385,
> member_id=820,
> more...}
>
> How do I make sense of this in JS? So far I have this...and it
doesn''t
> seem to be working:
> response = $.get(''/members/check_shared_from_fb'');
> in_json = $.parseJSON(response);
> alert(in_json.to_sting);
>
> The alert gives me null.
>
> I hope I was clear. Thanks for all your help.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/Jy7WrWMAnSgJ.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On 10 April 2012 12:13, bertly_the_coder <muchira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hahaha! Colin, you are a funny guy, eh?I don''t understand what is funny. I pointed out what seemed to be an obvious error in your code. It is easy to miss typographical errors when looking at your own code. Colin> > OK, That was a dumb mistake, this is what I get for mixing languages....for > anyone interested, the returned data is in the callback...duh! So the > response is in: > > $.getJSON(''/members/check_shared_on_fb_or_twitter'', > function(response) { > //use response, the returned JSON here > }); > > On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder wrote: >> >> Hi guys, >> >> I''m having a little bit of a problem. I have a controller method that >> renders json: >> render :json => current_member.to_json >> >> This method is called in a js file using a simple get call. In firebug >> I see that the response from the get call is a json string, as I >> wanted it to be: >> Object { created_at="2012-04-10T08:09:09Z", id=2385, >> member_id=820, >> more...} >> >> How do I make sense of this in JS? So far I have this...and it doesn''t >> seem to be working: >> response = $.get(''/members/check_shared_from_fb''); >> in_json = $.parseJSON(response); >> alert(in_json.to_sting); >> >> The alert gives me null. >> >> I hope I was clear. Thanks for all your help. > > > On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder wrote: >> >> Hi guys, >> >> I''m having a little bit of a problem. I have a controller method that >> renders json: >> render :json => current_member.to_json >> >> This method is called in a js file using a simple get call. In firebug >> I see that the response from the get call is a json string, as I >> wanted it to be: >> Object { created_at="2012-04-10T08:09:09Z", id=2385, >> member_id=820, >> more...} >> >> How do I make sense of this in JS? So far I have this...and it doesn''t >> seem to be working: >> response = $.get(''/members/check_shared_from_fb''); >> in_json = $.parseJSON(response); >> alert(in_json.to_sting); >> >> The alert gives me null. >> >> I hope I was clear. Thanks for all your help. > > > On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder wrote: >> >> Hi guys, >> >> I''m having a little bit of a problem. I have a controller method that >> renders json: >> render :json => current_member.to_json >> >> This method is called in a js file using a simple get call. In firebug >> I see that the response from the get call is a json string, as I >> wanted it to be: >> Object { created_at="2012-04-10T08:09:09Z", id=2385, >> member_id=820, >> more...} >> >> How do I make sense of this in JS? So far I have this...and it doesn''t >> seem to be working: >> response = $.get(''/members/check_shared_from_fb''); >> in_json = $.parseJSON(response); >> alert(in_json.to_sting); >> >> The alert gives me null. >> >> I hope I was clear. Thanks for all your help. > > > On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder wrote: >> >> Hi guys, >> >> I''m having a little bit of a problem. I have a controller method that >> renders json: >> render :json => current_member.to_json >> >> This method is called in a js file using a simple get call. In firebug >> I see that the response from the get call is a json string, as I >> wanted it to be: >> Object { created_at="2012-04-10T08:09:09Z", id=2385, >> member_id=820, >> more...} >> >> How do I make sense of this in JS? So far I have this...and it doesn''t >> seem to be working: >> response = $.get(''/members/check_shared_from_fb''); >> in_json = $.parseJSON(response); >> alert(in_json.to_sting); >> >> The alert gives me null. >> >> I hope I was clear. Thanks for all your help. > > > On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder wrote: >> >> Hi guys, >> >> I''m having a little bit of a problem. I have a controller method that >> renders json: >> render :json => current_member.to_json >> >> This method is called in a js file using a simple get call. In firebug >> I see that the response from the get call is a json string, as I >> wanted it to be: >> Object { created_at="2012-04-10T08:09:09Z", id=2385, >> member_id=820, >> more...} >> >> How do I make sense of this in JS? So far I have this...and it doesn''t >> seem to be working: >> response = $.get(''/members/check_shared_from_fb''); >> in_json = $.parseJSON(response); >> alert(in_json.to_sting); >> >> The alert gives me null. >> >> I hope I was clear. Thanks for all your help. > > > On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder wrote: >> >> Hi guys, >> >> I''m having a little bit of a problem. I have a controller method that >> renders json: >> render :json => current_member.to_json >> >> This method is called in a js file using a simple get call. In firebug >> I see that the response from the get call is a json string, as I >> wanted it to be: >> Object { created_at="2012-04-10T08:09:09Z", id=2385, >> member_id=820, >> more...} >> >> How do I make sense of this in JS? So far I have this...and it doesn''t >> seem to be working: >> response = $.get(''/members/check_shared_from_fb''); >> in_json = $.parseJSON(response); >> alert(in_json.to_sting); >> >> The alert gives me null. >> >> I hope I was clear. Thanks for all your help. > > > On Tuesday, April 10, 2012 12:27:29 PM UTC+3, bertly_the_coder wrote: >> >> Hi guys, >> >> I''m having a little bit of a problem. I have a controller method that >> renders json: >> render :json => current_member.to_json >> >> This method is called in a js file using a simple get call. In firebug >> I see that the response from the get call is a json string, as I >> wanted it to be: >> Object { created_at="2012-04-10T08:09:09Z", id=2385, >> member_id=820, >> more...} >> >> How do I make sense of this in JS? So far I have this...and it doesn''t >> seem to be working: >> response = $.get(''/members/check_shared_from_fb''); >> in_json = $.parseJSON(response); >> alert(in_json.to_sting); >> >> The alert gives me null. >> >> I hope I was clear. Thanks for all your help. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/Jy7WrWMAnSgJ. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en.-- gplus.to/clanlaw -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.