ajax upload cannot process JSON response or gives download popup

Posted by Jorre on Stack Overflow See other posts from Stack Overflow or by Jorre
Published on 2010-05-11T16:35:48Z Indexed on 2010/05/11 17:44 UTC
Read the original article Hit count: 576

Filed under:
|
|
|
|

I'm using the AJAX plugin from Andris Valums:

It works great, except for the fact that I cannot send proper JSON as a response. I'm setting the headers to 'Content-Type', 'application/json' before sending the JSON-encoded response, and in the plugin I'm saying that I'm expecting JSON:

responseType: "json",

This gives me a download popup asking to download the JSON/REPONSE file. The strange thing is, when I don't ass the correct "Content-Type" to my response, it works.

Of course I want to pass the correct response type, because all my jQuery 1.4 calls are depending on correct JSON.

Does anyone else have had this same problem or is there anyone out there willing to try this out ?

I'd love to use this plugin but only when I can return proper JSON with the correct content-type

Thanks for all your help!

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about upload