0

I have a ajax file upload code that gets back a json response from the server. The response works fine on Chrome, FF and IE 11 but on lesser versions of IE the response is getting the client side html instead of the json response. The jquery version am using is 1.5.1. I have tried setting the content type to text/html also the x-frame-option to Sameorigin but this didn't help.

Anyone who has found solution to this problem please help.

Jin
  • 13
  • 1
  • 8
  • the solution posted by James on the link http://stackoverflow.com/questions/18733754/incorrect-jqxhr-response-for-jquery-forms-plugin-in-ie8-and-9 didn't work for me.. – Jin Apr 19 '15 at 18:30
  • can u try it with jQuery 2.x – Legends Apr 19 '15 at 18:35
  • if i go any higher i start getting javascript errors – Jin Apr 19 '15 at 20:59
  • Since it is an existing site to which we are trying to introduce this ajax upload functionality its difficult to raise the jquery version. There are actually not 1-2 but a large number of defects when trying to raise the jquery version. – Jin Apr 20 '15 at 15:02
  • One interesting thing that came up is the ajax response is working perfect when in same domain. But when the html and the service are on different sub domains is when the response gets converted to client side html. – Jin Apr 20 '15 at 15:04
  • then u have to implement CORS, as this is not "Same Origin", right. http://www.html5rocks.com/en/tutorials/cors/ – Legends Apr 20 '15 at 15:58
  • Yes CORS has to be implemented. My scenario is to post multipart form data. I tried to find a example of XDomainRequest with multipart post data but couldn't find anything useful. Do you have any examples for such implementation? My backend service accepts multipart form data as request and gives a text response. – Jin Apr 22 '15 at 23:53
  • ok, but what did u try, did u read cors tutorial? Here is another useful link, just go through it: http://blog.kotowicz.net/2011/04/how-to-upload-arbitrary-file-contents.html – Legends Apr 23 '15 at 00:01
  • Yes i did try but stuck at how to send the form data to the backend service. I have mutiple file input fields on the html that need to be posted. In the link that you shared what the fileData is? – Jin Apr 23 '15 at 15:47
  • CORS request for file upload fails because you cannot set the content type for XDomainRequest. – Jin Apr 27 '15 at 15:26

0 Answers0