zoukankan      html  css  js  c++  java
  • MVC ---- ckeditor 循环遍历并绑定blur事件

        function GetFollowList(page) {
            var pages = { rows: 1, pages: page };
            pages = JSON.stringify(pages);
            var datas = { param: pages }
            $.ajax({
                url: "/Business/CustomerFollow/PaginationList",
                data: datas,
                dataType: "json",
                success: function (da) {
                    var htmls = "";
                    var datas = da.followlist;
                    var saa = [];
                    for (var i = 0; i < datas.length; i++) {
    
                        htmls += "<table class="ui-jqgrid-btable ui-common-table table table-bordered" style=" background:#ffffff!important; margin-bottom:30px;"><tr class="jqgfirstrow"><td style="height:50px;line-height:50px;">" + datas[i].CustomerId + "</td>" +
                                 "<td style="height:50px;line-height:50px;">" + datas[i].F_FullName + "</td><td style="height:50px;line-height:50px;">" + datas[i].F_Msisdn + "</td>" +
                                 "<td style="height:50px;line-height:50px;">" + datas[i].F_CreatorTime + "</td><td style="height:50px;line-height:50px;">" + datas[i].F_CreatorUserName + "</td></tr>" +
                                 "<tr><td colspan="5"><textarea id="" + datas[i].FollowId + "" class="ckeditor">" + datas[i].F_Description + "</textarea></td></tr></table>";
                        saa.push(datas[i].FollowId);
                    }
    
                    $("#tbodyHtmlId").html(htmls);
                    for (var j in saa) {
                        CKEDITOR.replace(saa[j]);
                        addblur();
                    }
                     
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert("XMLHttpRequest==" + XMLHttpRequest + "==textStatus" + textStatus + "==errorThrown=" + errorThrown);
                }
            });
        }




        $(function () {
    
            $('.ckeditor').each(function (i, item) {
                var a = $(this).attr("id");
                CKEDITOR.instances[a].on('blur', function () {
    
                    alert(i);
                    var tent = this.document.getBody().$.innerHTML;//获取当前内容。
                    var param = { fids: a, contents: tent }
                    var params = JSON.stringify(param);
                    $.ajax({
                        type: "Post",
                        url: "/Business/CustomerFollow/Update",
                        data: { "param2": params },
                        dataType: "json",
                        success: function (da) {
                        },
                        error: function (err) {
                            alert("保存出现问题了,请联系管理员!");
                        }
                    });
                });
            });
        });
    
        function addblur() {
            $('.ckeditor').each(function (i, item) {
                var a = $(this).attr("id");
                CKEDITOR.instances[a].on('blur', function () {
                    var tent = this.document.getBody().$.innerHTML;//获取当前内容。
                    var param = { fids: a, contents: tent }
                    var params = JSON.stringify(param);
                    $.ajax({
                        type: "Post",
                        url: "/Business/CustomerFollow/Update",
                        data: { "param2": params },
                        dataType: "json",
                        success: function (da) {
                        },
                        error: function (err) {
                            alert("保存出现问题了,请联系管理员!");
                        }
                    });
                });
            });
        }
  • 相关阅读:
    centos7 修复引导
    Django 过滤器
    Django 面向对象orm
    Django models字段查询谓词表
    linux常用的监控命令
    常用SQL语句
    python实现FTP服务器
    用python做一个图片验证码
    rsync
    jsonp的理解
  • 原文地址:https://www.cnblogs.com/youmingkuang/p/7277924.html
Copyright © 2011-2022 走看看