# JQuery + Rails problem retreiving JSON

**URL:** <https://www.ruby-forum.com/t/jquery-rails-problem-retreiving-json/174522>\
**Category:** Rails\
**Created:** [August 28, 2009, 2:28am UTC](https://www.ruby-forum.com/t/jquery-rails-problem-retreiving-json/174522 "2009-08-28T02:28:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lpdahito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d2c977/32.png) [@lpdahito](https://www.ruby-forum.com/u/lpdahito)\
**Post date:** [August 28, 2009, 2:28am UTC](https://www.ruby-forum.com/t/jquery-rails-problem-retreiving-json/174522/1 "2009-08-28T02:28:37Z")

</div>

Hi guys,

I have a problem retrieving data in JSON format using Ajax with  
JQuery.  
Here’s the code I use:

/app/controllers/stories\_controller.rb:

def index  
@stories = Story.all

```
respond_to do |format|
  format.html # index.html.erb
  format.xml { render :xml => @stories }
  format.json { render :json => @stories, :callback => params

```

[:callback] }  
end  
end

/app/views/layouts/application.html.erb  
…  
\<%= javascript\_include\_tag “jquery” %\>

…

Here’s the problem I have…  
The alert box that pops up diplays the following:

[http://localhost:3000](http://localhost:3000)  
[object Object]

What’s worst is that Rails retreives my data and returns it in a  
proper JSON format since when  
I enter [http://localhost:3000/stories.json](http://localhost:3000/stories.json) I get the JSON file…

What’s wrong with JQuery ??? I do exactly what they say on their  
Website…

I need help please…

Thx…
