On 17 Mar., 16:10, “tashfeen.ekram” [email protected] wrote:
I am trying to follow this tutorial here by Ryan :http://railscasts.com/episodes/136-jquery
it is a AJAX tutorial on using jquery and expecting the response to be
however, i am getting the response to be rendered in the default
layout. i am getting the appropriate response but the js is embedded
in HTML and thus not execuuted. is there a way to turn the rendering
off for certaini cases?
Rails should really not use the layout unless it’s an HTML request.
Let me ask you something: Did you accidentally call the view
create.html.erb instead of create.js.erb? Remember, the name of a view
is separated in three parts by dots: The first one is the name of your
action (in this case “create”), the second one is the format (in this
case it should be “js” to avoid embedding the output in the layout),
the third is the template language (in this case “erb” or embedded
Ruby, but it could also be “haml”, “builder”, “rjs” or whatever suits
the need of that specific view).
And then if you are sure that the view is correctly named: What
version of Rails do you use? You can find out by looking in your