PermissionsController
def add_member
…snip… @permissions = Permission.all
respond_to do |format|
format.html {
flash[:messages1] = @permission.user.name + " has been given
rights."
}
format.js
end
end
That looks like a clue. Have you checked your request header?
I think so… I’ve been staring at firebug and even copied the errors
out of firebug and this looks like it wants to respond to html and not
js and in fact, I enabled it to ‘render :partial => “permissions”’ and
it clearly wants to respond with html and not js.
I think so… I’ve been staring at firebug and even copied the errors out of
firebug and this looks like it wants to respond to html and not js and in fact, I
enabled it to ‘render :partial => “permissions”’ and it clearly wants to respond
with html and not js.
Then my best advice would be to double check the accepts header using
Live Http Headers. You may need to do some explicit setup prior to
the post.
That looks like a clue. Have you checked your request header?
I think so… I’ve been staring at firebug and even copied the errors out of
firebug and this looks like it wants to respond to html and not js and in fact, I
enabled it to ‘render :partial => “permissions”’ and it clearly wants to respond
with html and not js.
Then my best advice would be to double check the accepts header using
Live Http Headers. You may need to do some explicit setup prior to
the post.
wish I understood what you are trying to tell me here
actually I am using replaceWith in some places in my js code itself but
the code in add_member.js.erb isn’t getting executed at all and it’s
responding to html instead.
Live HTTP is a plugin for Firefox that shows you the headers for
each request-response cycle. I’ve pasted in the first frame you’ll
get visiting the link above below. It’s got 2 sections. The first
shows the headers sent on the request. The second shows the headers
sent on the response. The Accept header content is on the 4th line of
the request section. In this case, the client is telling the server
that its first preference is for html and you can see from 2nd line in
the response section that that is what the server sends back.
GET /blog/browser-rest-http-accept-headers HTTP/1.1
If what you see from looking at what’s produced in Live HTTP by
your post is that the request’s Accept header is not requesting
javascript (text/script iirc) then the problem is explained. The
‘fix’ is to set the request’s Accept header. I did a quick google on
‘jquery ajax set header’ and got good results. This one looked like a
good place to start. http://snipplr.com/view/9869/
My apologies. Not sure which part of the three above I should
sent on the response. The Accept header content is on the 4th line of
Gecko/20111107 Ubuntu/10.04 (lucid) Firefox/3.6.24
Probably does help but this is my ‘side’ project at work - done on my
slack time and I have had my hands full so I didn’t get any time to do
much with it but I wanted to acknowledge your e-mail, say thanks but it
may be a few more days before I get the time to go through it all.
Craig
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.