IE tries to download json response while submitting jQuery multipart form data containing file

后端 未结 9 661
别那么骄傲
别那么骄傲 2020-12-14 15:03

I\'m trying to submit a form with a file field in it via jQuery.Form plugin, here\'s the code:

$(\'form\').ajaxSubmit({
  url: \"/path\",
  data         


        
9条回答
  •  一向
    一向 (楼主)
    2020-12-14 15:20

    Same situation than you folks : the problem only occurs with enctype="multipart/form-data" form used with $(form).ajaxSubmit(...) function.

    My team and I had to replace (in this function) dataType: 'json' option with dataType: 'text' and add responseText = $.parseJSON(responseText); to force server response parsing.

    Of course we also had to step in server side to return a response with "text/plain" header instead of "application/json"

    We're not proud of it :( IE is definitely killing everything...

    I didn't try the advice given by zmonteca (already spent too much time on it) but it seems worthy : let us know if it was OK for you.

    Hope it helps!

提交回复
热议问题