sarbogast / grails-bootstrap-file-upload

Grails Plugin to integrate Sebastian Tschan's Jquery File Upload
http://grails.org/plugin/bootstrap-file-upload
Apache License 2.0
33 stars 25 forks source link

Demo controller does not work with IE #4

Open liftyourgame opened 12 years ago

liftyourgame commented 12 years ago

Using IE9 and your controller doesn't work for IE. The POST returns JSON via the Ifram but IE does not know how to render JSON.

Replace the end of the post method line: "render results as JSON" with

            if (request.xhr) {
                render results as JSON
            } else {
                def jsonString = (results as JSON).toString()
                render jsonString
            }

Add to Bootstrap init:

    HttpServletRequest.metaClass.isXhr = {->
        'XMLHttpRequest' == delegate.getHeader('X-Requested-With')
    }
sarbogast commented 12 years ago

Which version of the plugin are you using? Because I think I already fixed this problem is the latest version.

liftyourgame commented 12 years ago

Hi Sebastien,

I'm using the version listed on the Grails plugin page: compile ":bootstrap-file-upload:2.1.1"

Also the controller should check the request header to see if the caller accepts application/json instead of checking for XHR

Regards,

Greg

On 6/07/2012 11:33 PM, Sebastien Arbogast wrote:

Which version of the plugin are you using? Because I think I already fixed this problem is the latest version.


Reply to this email directly or view it on GitHub: https://github.com/sarbogast/grails-bootstrap-file-upload/issues/4#issuecomment-6805051