On Jun 4, 4:33 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> On Jun 3, 8:47 pm, rdavila <ruben.grung...@gmail.com> wrote:
>
> > Hi, I've a weird problem, I'm using Rails 3 with prototype 1.6.1 and I
> > want to send my form via Ajax, when I set the ":remote => true" option
> > in the form generator all works fine(It's handled by rails.js), but If
> > I want to customize the request it fails with 406 error, I've checked
> > the header with the Live HTTP Headers extension for Firefox and I saw
> > that the "Accept" isn't set correctly:
>
> > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
> > *;q=0.8
>
> What are you _expecting_ the `Accept` header to be? E.g., what's
> incorrect about that one?
>
The correct header should be:

Accept: text/javascript, text/html....

So, Rails can detect that request as a Javascript request and not
HTML.

>
>
> > Here is the JS code:
>
> > document.observe("dom:loaded", function() {
> >   $('new_user').observe('submit', function(){
> >     new Ajax.Request('/users', {
> >       parameters: this.serialize(),
> >       asynchronous: true,
> >       evalScripts: true,
> >     });
> >   });
>
> > });
>
> Slightly off-topic, but that code will fail in IE (you need to get rid
> of the comma after `evalSdcripts: true`.

This was a litle typo ;)

>
>
> > I don't know why Prototype doesn't set the headers fine. I saw the
> > source code ant it should be set this headers.
>
> > Thanks.
>
> FWIW,

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to