English 中文(简体)
TinyMCE在http://questxhr ajax上生成的网页
原标题:TinyMCE not working in http request xhr ajax generated page

因此,我有一页的链接,称为Request。 请求书用一个文件,即从我的sql中收集的粉碎数据,然后填入浏览器/网页。 我的问题是,如果通过www.request/ajax将网页归还给浏览器,文本区不显示锡米斯编辑,它只是显示一个正常的文本区。 它像我的要求一样,认为Ajax正在对文本区进行罚款,而只有锡克米编辑。

如果不使用麻醉器,则会做罚款,但如果将它放在单独的档案中,并通过麻风气将其提上,那么它就没有将它带到锡永冰的编辑上。

是否有任何人知道如何解决这一问题,以便我的麻风病生成的页面能够与锡石编辑展示文字。 谢谢。

最佳回答

I fixed this problem by recalling the function after the ajax call. In this part of my ajax:

if (xmlhttp.readyState==4 && xmlhttp.status==200)
     {
     document.getElementById("Content").innerHTML=xmlhttp.responseText;
     tinymce();

现在,它会做罚款。

问题回答

让我们推测,你 thin不清的幼儿保育中心最初采用以下编码。

// initialize tinyMCE in page
tinyMCE.init({
    mode: "textareas",
    theme: "advanced"
});

and you have some kind of button somewhere in the page. F或 purpose of this tip, i will not give it any ID but you may. Now, using jQuery you can easily attach event handler to that button which will call through AJAX your server and take content which you want to put tinyMCE edit或. Code which will do such job would look somehow like below.

$(function() {

    $("button").bind("click", function() {
        var ed = tinyMCE.get( content );
        ed.setProgressState(1); // Show progress
        $.getJSON( /page/12.json , { /* your data */
        }, function(data) {
            ed.setProgressState(0); // Hide progress
            ed.setContent(data["body"]);

        }
        });
    });
});

你可以在纽顿看到这一点。 点击ajax将打电话<代码>/page/12.json,将JSON作为回应。 作出这种反应的最低限度是:

{
   title: "Page title",
   body: "<html><head><title>Page title</title>......</html>"
}

I attached anonymous function as callback which will handle response from server. and hide progress indicat或 which is shown bef或e ajax call.

www.un.或g/Depts/DGACM/index_spanish.htm 约名

JSON公司正在缩短Java Object或y Notation。 is条! 因此,不要混淆。 利用JSON,你可以做一刀切的物品,这些物品可以使你在后来的法典中能够使用,以获得反对“搁置”的数据。 如果你比较容易的话,你可以视之为某种数据结构。

不管怎么说,通过亲眼看下面的例子,向你们说明如何创建这名初等人物。

var data = new Object();
data.title = "Page title";
data.body = "<html....";

var data = {
    title: "page title",
    body: "<html...."
};

这完全相同。

If you want to learn m或e about JSON point your browser to http://json.或g.

<>============ ===

替代json解决办法的办法可能只是向服务器发出一个jax电话,而对策可以是简单的超文本(从你的问题来看,我可以认为你有类似的东西)。 因此,请设<代码>$.getJSON的斜体可使用$.get(url,etback);做同样的事情。 我回答之前的守则不会发生重大变化。 不要让JSON作回应,你就会得到超文本的扼杀。

页: 1 页: 1

I prefer JSON since it can be easily extended later with other attributes, so there is no painful code changes later ;)

Problem here will be that when you return the full page and render it using the ajax response, your tinymce instance has not been shut down before. In order to do this you can call this small piece of code before you render the ajax response:

tinymce.execCommand( mceRemoveControl ,true, editor_id );

在这种情况下,编辑应正确开首。 不允许你在关闭第一个编队之前,先从同一个编辑开始。

Strangely i ran into this problem yesterday. Following code should work, but YMMV. Trick is to use the correct steps in ajax events. I used the Regular TinyMCE and made use of the jQuery library already included.

之后进入了您的连续版本tinyMCE.init(。 以下所有部分都应不在<代码>文件>ready之内。

 myTinyInit = {
     //.......All essential keys/values ...........

      setup : function(ed) {
                 ed.onChange.add(function( ed ) {
                       tinyMCE.triggerSave();
                }) }
     //.....................

 };
 // Init the tinyMCE 
 tinyMCE.init(myTinyInit);

This ensures the content is being saved regularly onto the textarea that holds the value. Next step is setting up the request events.

通常情况下,在麻省成功之后,在亚克斯岛的哨所和<代码>mceRemoveControl之前,继续留守。 但我发现,往往不可行。

我在我的案件中将这一表格作为 j选人使用。

jQuery(  .myForm  )
.find(  textarea#myTextArea  )
.ajaxStart(function() {
   // If you need to copy over the values, you can do it here.
   // If you are using jQuery form plugin you can bind to form-pre-serialize event instead.        
   // jQuery( this ).val( tinyMCE.get( jQuery( this ).attr(  id  )).getContent() );

}).ajaxSend( function() {

    // ! - step 2 
    // My case was multiple editors.
    myEds = tinyMCE.editors;
    for( edd in myEds ) {
       myEds[ eds ].remove();
    } 

    // tinyMCE.get(  myTextarea  ).remove(); 
    // strangely mceRemoveControl didnt work for me. 
    // tinyMCE.execCommand(  mceRemoveControl , false, jQuery( this ).attr( id )); 

}).ajaxSuccess(function() {

    // Now we got the form again, Let s put up tinyMCE again.
    txtID = jQuery( this ).attr(  id  );

    // ! - step 3 
    tinyMCE.execCommand(  mceAddControl , false, txtID ); 


    // Restore the contents into TinyMCE. 
    tinyMCE.get( txtID ).setContent( jQuery( this ).val());

});

www.un.org/Depts/DGACM/index_spanish.htm 问题一:

  1. Using mceRemoveControl always gave me r is undefined error persistently.
  2. If you get a blank tinyMCE editor, check the DOM whether the ID of the textarea is replaced with something like mce_02, this means that TinyMCE is being initialized again or something is wrong with the order. If so, the tinyMCE is duplicated with each save.
  3. if you are new to JS, I recommend using jQuery with the form plugin, it might be easier for you. But do use the regular non-jquery tinyMCE, as it is well documented.




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签