IE 提示打开或保存来自服务器的 json 结果 [英] IE prompts to open or save json result from server

查看:25
本文介绍了IE 提示打开或保存来自服务器的 json 结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

兼容模式下的浏览器通过ajax回调的方式从服务器获取数据,如果我想保存数据或打开,会弹出一个对话框.如何摆脱它?

Internet explorer in compatibility mode gets the data from the server in an ajax callback method, and pops-up a dialog if I want to save the data or open. How to get rid of that?

客户说:

$.ajax({
        type:'POST',
        data: $("#UIdlgHolder > form").serialize(),
        url: $("#UIdlgHolder > form").attr("action"),
        success: function (data, textStatus, jqXHR) {
            {
                alert(data.message);
            }
}

服务器回答:

return new JsonResult { Data = new { result = false, message = "Yay!" } };

推荐答案

听起来这个 SO 问题可能与您有关:

Sounds like this SO question may be relevant to you:

如何说服 IE 简单地显示应用程序 json 而不是提供下载

如果不是:

您是否尝试过在 ajax 选项中设置预期的数据类型?即数据类型:'json'

Have you tried setting the dataType expected in the ajax options? i.e. dataType: 'json'

您是否尝试过其他内容类型,例如application/json"或text/javascript"

Have you tried other content types such as 'application/json' or 'text/javascript'

这篇关于IE 提示打开或保存来自服务器的 json 结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆