您的位置:首页 > 其它

ContentType是否大小写区分?

2015-09-08 13:24 162 查看
ContentType控制web类型输出。无论是大小写是否区分?

例如:

context.Response.ContentType = "application/json";


context.Response.ContentType = "application/Json";


是否同样呢?

本来执行全然没有问题的代码。前台代码:

$.ajax({ type: "post",
url: urlAjax + "?

OperationType=add",
data: $(formId).serialize(),
success: function (msg) {
var obj = jQuery.parseJSON(msg);
if (obj.IsSuccess == true) {
$.messager.alert('提示', obj.Msg,'info',SaveOkCallback);
}
else {
$.messager.alert('提示', obj.Msg);

}
EnableButton(true);
}
});


后台代码:

context.Response.ContentType = "application/Json";


当我把后台代码改动成

context.Response.ContentType = "application/json";


时,前台直接报错了!

!是这一句!!

jQuery.parseJSON(msg)


没有IsSuccess属性!!!

终于查出来的原因居然是一个大写和小写的问题导致的!!

看来ContentType它是大小写区分,但我没有找到相关信息!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: