zoukankan      html  css  js  c++  java
  • ueditor+asp.net异步提交,可以实现了,嘿嘿

    之前没用过Ueditor去异步提交,最近项目需要用到这个,就下了个来用,结果可能没仔细去看Ueditor的相关介绍文档,然后自己也郁闷了一下才把它弄出来,现在可以实现异步提交了,松口气,把代码贴出来,以备参考!如果哪里写得不好,请帮我指出来哦,谢谢!
     
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" ValidateRequest="false"
        Inherits="WebApplication2.CommunityAdmin.test" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript" src="ueditor/editor_all_min.js"></script>
        <script type="text/javascript" src="ueditor/editor_config.js"></script>
        <link rel="Stylesheet" href="ueditor/themes/default/ueditor.css" />
        <script type="text/javascript" src="../Scripts/jquery-1.4.1.min.js"></script>
    </head>
    <body>
        <script type="text/javascript">
            var editor = new UE.ui.Editor();//实例
            editor.render('myeditor');//渲染编辑器
            $(function () {
     
     
                $("#btn").click(
            function () {
                var nn = editor.getContent();
     
                editor.sync();//这一句至关重要,没有它,甭想异步提交了
     
                $.ajax(
                {
                    url: "Handler1.ashx",
                    type: "post",
                    data: "wenben=" + nn,
                    success: function (data) {
     
                        alert(data);
     
                    }
     
                }
                );
            });
     
            });
        </script>
        <textarea name="mycontent" rows="" cols="" id="myeditor"> </textarea>
        <input type="button" id="btn" />
     
    </body>
    </html>
     
     
     
    ------------------------------------------------------------------------------------------------------------
    ------------------------------------------------------------------------------------------------------------
    Handler1.ashx.cs
     
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
     
    namespace WebApplication2.CommunityAdmin
    {
        /// <summary>
        /// Handler1 的摘要说明
        /// </summary>
        public class Handler1 : IHttpHandler
        {
     
            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(context.Request["wenben"]);//这个标红色的地方要注意不要写错!
            }
     
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }
    本人博客的文章若有侵犯他人的地方,请告知!若有写的不对的地方,请指正!谢谢!
  • 相关阅读:
    bzoj1051(明星奶牛)
    hdu4081(秦始皇的道路系统)
    bzoj2330(差分约束)
    JPA & Hibernate 注解
    Hibernate中对象的3种状态:瞬时态、持久态、脱管态
    Spring Data JAP 多个不是必填的查询条件处理
    设计模式
    Java远程方法调用(RMI)
    Javascript注意事项四【提高循环性能的策略】
    Javascript注意事项三【使用假值】
  • 原文地址:https://www.cnblogs.com/QMM2008/p/3532929.html
Copyright © 2011-2022 走看看