I've also been having this problem.  I'm sending a comment to the
server, and returning a JSON object to write the comment to the page w/
o a refresh.

Request.JSON = new Class({
...
        initialize: function(options){
                this.parent(options);
                this.headers.extend({'Accept': 'application/json', 'X-Request':
'JSON'});
        },
        success: function(text){
                this.response.json = JSON.decode(text, this.options.secure);
                this.onSuccess(this.response.json, text);
        }
});


This is the JSON request method, have you tried:
this.headers.extend({'Accept': 'application/json', 'X-Request':
'JSON'});
??



On Nov 2, 2:51 pm, Jon Hancock <shellsha...@gmail.com> wrote:
> I'm using Form.send in a standard way:
>
> form.set('send', {
>    onSuccess: function(responseJson) {
>       var response = JSON.decode(responseJson)
>       // do something
>    }});
>    form.send();
>
> The return of this post is Content-Type: application/json;
> charset=utf-8
> Before I upgraded my server stack, this was returning Content-Type:
> text/html  and everything worked well.
>
> I think this is what is causing the browser (all of them) to try to
> open a file on the results instead of allowing me to process the
> JSON.  My onComplete or onSuccess handlers are not getting called.
> I'm guessing this is because Form.send is expecting Content-Type: text/
> html
>
> I've tried a few ways to get Form.send to know it should get back
> json, but haven't hit on the answer yet.
> any ideas?
> thanks, Jon

Reply via email to