TinyMCE 在表单提交时显示等待状态

发帖时,输入一大篇文章,点击发布的时候,编辑器变成堵塞状态,有个小轮转啊转
请看 ajaxStart 和 ajaxComplete 两个方法

$(document).ready(function() {
    $('#f_title').focus();
    $('#form_thread').ajaxForm({
        dataType: 'json',
        success: function(json) {
            if(json.msg){
                $('#error_msg').hide();
                $('#error_msg').html(json.msg);
                $('#error_msg').show("fast");
            }
            else if(json.id){
                location.href = "$link.root("bbs/thread/")" + json.id;
            }
        }
    });
    $('#form_thread').bind('form-pre-serialize', function(event,form,options,veto){
        tinyMCE.triggerSave();
    });
    
    $("#form_thread").ajaxStart(function(){
       if(tinyMCE && tinyMCE.get('f_content'))
       tinyMCE.get('f_content').setProgressState(1); // Show progress
    });
    $("#form_thread").ajaxComplete(function(event,request, settings){
       if(tinyMCE && tinyMCE.get('f_content'))
       tinyMCE.get('f_content').setProgressState(0); // Show progress
    }); 
});

 

原文地址:http://www.oschina.net/code/snippet_12_1456

posted @ 2012-05-07 17:39  我思故我在...  阅读(650)  评论(0)    收藏  举报