# How can I return a json packet?

**URL:** <https://www.ruby-forum.com/t/how-can-i-return-a-json-packet/113033>\
**Category:** Rails\
**Created:** [August 26, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/how-can-i-return-a-json-packet/113033 "2007-08-26T15:43:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hashman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@hashman](https://www.ruby-forum.com/u/hashman)\
**Post date:** [August 26, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/how-can-i-return-a-json-packet/113033/1 "2007-08-26T15:43:49Z")

</div>

I used extjs and ror,this is the part of my ror code:

def create

```
@enterprise = Enterprise.new(@params[:enterprise])

p @enterprise

```

if @enterprise.save  
flash[:note] = ‘Enterprise unit was successfully created.’  
p “michael”  
redirect\_to(:action=\>index)

```
else
  p "error"
  render_action 'new'
end
p 'end'

```

end

but each time my explore can’t direct to another page.I ask the  
extjs,here is the ansower:

Form’s submit method performs an Asynchronous submit via an Ajax  
request. It looks for a success attribute in the JSON packet which is  
returned by the server-side. Change the response to {success: true}  
and then in your success handler redirect the page via JS.

so how can I return a json packet from ror
