zoukankan      html  css  js  c++  java
  • asp.net中使用jquery ajax保存富文本的问题

    前提:为了保证页面的不刷新行为,所以采用了html+jquery+handler的页面保存方式,通过ajax将富文本内容传递给一般处理程序进行操作。

    一。问题:1.大文件无法上传?

               2.传入handler后,提示富文本内容存在安全风险?

    以上两个问题都可以通过配置web.config来解决问题:

     <system.web>
        <compilation debug="true" targetFramework="4.5"/>
        <httpRuntime targetFramework="4.5" maxRequestLength="409600" requestValidationMode="2.0"/>
     </customErrors>
      </system.web>
    

      

    将验证模式降为“2.0”,并且设置上传文件的最大尺寸,以(kb)为单位。

    二。问题:1.点击保存富文本内容的时候,有时无法触发保存按钮的功能。(通过jquery的ajax保存数据)

                      2.当我删除某些富文本内容后,又可以触发保存按钮的功能。(有时候删除某些文字或者html对象)

    下面是我的代码:

            //保存内容
                    $.ajax({
                        url: "../Handler/AgreementManage/AgreementManager.ashx",data: { type: 'save', data: dataRestult }, success: function (data) {
    
                            if (data == "True") {
    
                               
                                $.messager.alert("系统提示", "协议保存成功", "info");
                            }
                            else {
                                $.messager.alert("系统提示", "协议保存失败", "info");
                            }
    
    
                        }
                    });
    

      后来想,有可能是ajax的type有问题,因为并不是一直都无法触发,是当富文本的内容发生变化后有时会因为这个bug,所以添加ajax的实现方式:

    type:"post",
    

      问题解决!都是type惹的祸,以后记住,不管怎样的ajax方式,最好都要习惯性的注明。

  • 相关阅读:
    CNN comprehension
    Gradient Descent
    Various Optimization Algorithms For Training Neural Network
    gerrit workflow
    jenkins job配置脚本化
    Jenkins pipeline jobs隐式传参
    make words counter for image with the help of paddlehub model
    make words counter for image with the help of paddlehub model
    git push and gerrit code review
    image similarity
  • 原文地址:https://www.cnblogs.com/pressforward/p/7098641.html
Copyright © 2011-2022 走看看