ContentType是否大小写区分?
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它是大小写区分,但我没有找到相关信息!!
版权声明:本文博主原创文章。博客,未经同意不得转载。
 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号