zoukankan      html  css  js  c++  java
  • 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它是大小写区分。但我没有找到相关信息!!


    版权声明:本文博主原创文章。博客,未经同意不得转载。

  • 相关阅读:
    时间日期事件处理、长按事件
    单选按钮触发事件、下拉列表触发事件
    事件
    笔记3
    笔记2
    笔记1
    布局管理器
    08、shell三剑客之sed
    07、shell三剑客之grep
    06、shell正则表达式
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4888050.html
Copyright © 2011-2022 走看看