json xhr response opens a download file popup window

前端 未结 5 1701
孤街浪徒
孤街浪徒 2021-02-04 08:09

For one of our ajax request (with a .json response) some of our clients have complained that they are seeing a \"File Download\" prompt asking the user to download the .json res

5条回答
  •  误落风尘
    2021-02-04 08:39

    For people who are using ASP MVC and have the same problem with IE, use this when returning your response:

    return Json(result, "text/plain");
    

    Edit: the standard type is: "application/json", but does not work with IE. using text/html is dangerous.

提交回复
热议问题