I’m using the AJAX plugin from Andris Valums:
- AJAX Upload ( http://valums.com/ajax-upload/ )
- Copyright (c) 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
Since the plugin is not true Ajax and because your setting the content type to application/json, the only response you will get will be a file download dialog.
The only way (i can see) would be to remove the content type you have set and within javascript use something like
I used the above method a couple of days ago using the same plugin.