UEditor提交

前端代碼

<body>
    <form action="server.php" method="post">
    <li class="clearfix"><label class="label_name">(這裏用udeitor編輯器填寫內容)</label>
        <!-- 加載編輯器的容器 -->
        <script id="container" name="content" type="text/plain">
            這裏寫你的初始化內容
        </script>
        </li>
        <button onclick="article_save_submit();" class="btn btn-primary radius" type="submit">保存並提交</button>
    </form>




    <!-- 配置文件 -->
    <script type="text/javascript" src="ueditor.config.js"></script>
    <!-- 編輯器源碼文件 -->
    <script type="text/javascript" src="ueditor.all.js"></script>
    <!-- 實例化編輯器 -->
    <script type="text/javascript">
        var editor = UE.getEditor('container');
    </script>


<scipt>
<!--調用ajax提交-->
function article_save_submit(){
<!--獲取ueditor內榮,後臺屬性驅動或對象驅動即可-->
       var content = UE.getEditor('editor').getContentTxt();
     alert(content)
    $.ajax({
        url : "${pageContext.request.contextPath}/hello1.action",
        timeout : 300000,
        dataType : "json",
        type : "post",
        data : {test:content},
    });                                 
    }
</script>

</body>

後臺代碼

    @RequestMapping("/hello1")
    public void hello1(String test) {
        System.out.println("測試值:" + test);
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章