wp_editor() in content that was loaded with ajax [duplicate]

Solution:

Add wp_editor() in somewhere that works perfectly and hide it.

<div class="hidden-editor-container" style="display:none;">
    <?php wp_editor( '', 'editor' ); ?>
</div>

after that assign editor contents to the global JS variable.

EDITOR = $('.hidden-editor-container').contents();

Finally when the ajax page is loaded append editor contents

$('.editor').append( EDITOR );

tinymce.execCommand( 'mceRemoveEditor', false, 'editor' );
tinymce.execCommand( 'mceAddEditor', false, 'editor' );