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

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

问题描述

Internet Explorer的兼容模式获取一个ajax回调方法从服务器上的数据,将弹出一个对话框,如果我想保存数据或打开。如何摆脱呢?

客户说:

  $。阿贾克斯({
        输入:POST,
        数据:$(#UIdlgHolder>表),序列化()。
        网址:$(#UIdlgHolder>表)ATTR(行动)。
        成功:功能(数据,textStatus,jqXHR){
            {
                警报(data.message);
            }
}

服务器应答:

 返回新JsonResult {数据=新的{结果=假,消息=耶! }};


解决方案

听起来这太问题可能是与你有关的:

<一个href=\"http://stackoverflow.com/questions/2483771/how-can-i-convince-ie-to-simply-display-application-json-rather-than-offer-to-dow\">How我能说服IE浏览器只显示应用JSON,而不是提供下载

如果不是:

你有没有尝试设置有望在阿贾克斯选项的dataType?即数据类型:JSON

您是否尝试过其他形式的内容,如应用/ JSON或文/ JavaScript的

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?

client says:

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

server answers:

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

解决方案

Sounds like this SO question may be relevant to you:

How can I convince IE to simply display Application json rather than offer to download

If not:

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

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

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

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