views:

26

answers:

1

I have a form created using HAML, that is submitted via:

$('appt_form').request({
    onComplete: function(){ 
        ...
    }
})

And for testing I have the controller simply returning:

render :json => {:name => "Ted"}.to_json

But that causes the browser to launch a dialog that has the options to 'Open with...' or 'Save As...'.

I havew other methods that are called from AJAX and return json that work just fine using

req = new Ajax.Request('/mycontroller/')

But I can't figure out what's different in the first case. Thoughts?

A: 

I'm guessing the mime type returned from the server is one that the browser expects is a file to save which is why you see that dialog.

This might arise from an Accept header being sent with a mangled mime-type from the request in the first type but not from the second. See if you can see a different between the requests in the logs.

Redbeard