Last active
December 9, 2018 01:51
-
-
Save technoknol/eae6d5ed5ebf3670f3fe to your computer and use it in GitHub Desktop.
wp_editor() using AJAX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.ajax({ | |
| url : '<?php echo admin_url('admin-ajax.php'); ?>', | |
| data : { product_cat: category , action : 'newproduct_form'}, | |
| method : 'post', | |
| success : function(form){ | |
| if (form != 0) { | |
| // remove existing editor instance | |
| tinymce.execCommand('mceRemoveEditor', true, 'post_content'); | |
| // init editor for newly appended div | |
| var init = tinymce.extend( {}, tinyMCEPreInit.mceInit[ 'post_content' ] ); | |
| try { tinymce.init( init ); } catch(e){} | |
| } | |
| } | |
| }); | |
| // Article : http://shyammakwana.me/wordpress/wordpress-load-wp_editor-ajaxjquery.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment