Thanks for response Richard. Not sure exactly what you mean.
The response from the server when I key in the url directly to chrome
is a json array/hash of previously entered data:
[{"post":
{"device":"palm","location":"dublin","created_at":"2010-09-09T06:03:58Z","updated_at":"2010-09-09T06:03:58Z","nickname":"nige","level":
82,"id":1,"devid":"001000230","score":200,"message":"my score sucks"}},
{"post":
{"device":"iphone","location":"london","created_at":"2010-09-09T17:13:20Z","updated_at":"2010-09-09T17:13:20Z","nickname":"greg","level":
54,"id":2,"devid":"465465468","score":6000,"message":"Check it out.
Love this game!!"}}}
Matches what I entered. So that's ok.
The server is a Rails server. Webrick outputs the following when I use
the code from my first post:
Processing ApplicationController#index (for y.y.y.221 at 2010-09-15
14:59:22) [OPTIONS]
But by directly keying in the url to chrome Rails responds with:
Processing PostsController#index to js (for y.y.y.221 at 2010-09-15
15:01:16) [GET]
It's like the request is not understood by Rails.Or it is malformed
somehow. It doesn't get it's a GET request and bypasses the
PostsController.
On Sep 15, 2:21 pm, Richard Quadling <[email protected]> wrote:
> On 15 September 2010 12:28, [email protected]
>
>
>
>
>
> <[email protected]> wrote:
> > I have the following request in my app. It works fine in Safari 5.
>
> > new Ajax.Request('http://x.x.x.x:3000/posts.js',
> > {
> > method:'get',
> > requestHeaders: {Accept: 'application/json'},
> > onSuccess: function(transport){
> > var response = transport.responseText;
> > var posts = response.evalJSON();
> > etc....
> > }
> > });
>
> > In chrome 5 I get the error Refused to get unsafe header "X-JSON".
>
> > When I point the chrome browser at my url json is returned but with
> > the warning:
> > Resource interpreted as document but transferred with MIME type text/
> > javascript.
>
> > The content type in the request is application/x-www-form-urlencoded.
>
> > Any ideas?
>
> > Nige
>
> > --
> > 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
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> What type is the response forhttp://x.x.x.x:3000/posts.js
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.