WordPress.org

Ready to get started?Download WordPress

Forums

Loading wp_editor through wordpress ajax not working (5 posts)

  1. macpraveen
    Member
    Posted 2 years ago #

    Hi
    I am trying to load wp editor (through wp_editor() function) using wordpress admin ajax inside a jquery tab for my plugin.

    But the editor is not displayed properly. No icons but visual/html tabs and media upload works.

    I see that wp loads some js for tinymce in footer when loaded normally without ajax. But how to do the same when loaded via ajax?

    Thanks
    Praveen

  2. polaris1
    Member
    Posted 2 years ago #

    Hi Macpraveen,

    I am working on something similar and I noticed that in order for the icons to display properly the editor needs to be passed a unique id when you call it.

    It seems like you might have an answer to a related question I have -- I would like to fetch a wp editor on demand using ajax, but all I can seem to do with wp_editor() is echo the editor, not put it into a string to send to my javascript. How are you fetching an editor using ajax?

    This is what isn't working:

    function addquestionanswerbox() {
    		$boxHTML="";
    		$boxHTML+= "<h2>Question {($number+1)} :</h2>";
    		$boxHTML+= wp_editor( $question_c , "qaeditorq{($number+1)}", array('textarea_name'=>"qa_question[]") );
    		$boxHTML+= "<h2>Answer{($number+1)} :</h2>";
    		$boxHTML+= wp_editor( $answer_c , "qaeditora{($number+1)}", array('textarea_name'=>"qa_answer[]") );   
    
    	$result=json_encode($boxHTML);
    	echo($result);
    	exit;

    I would love to hear how you did this!

    Thanks

  3. polaris1
    Member
    Posted 2 years ago #

    Sorry, I should have been more specific about the answer to your question:

    wp_editor("" , "uniqueid", array('textarea_name'=>"textareaname") );

    should produce a functioning editor with nothing in it.

  4. bsieders
    Member
    Posted 2 years ago #

    Hi guys,

    Sorry to bump this question but I am also looking for the exact same solution. I tried loading the wp_editor via ajax and just get a half arsed textarea instead.

    Anybody else know if there is a way?

    Balthazar

  5. ridwan developer
    Member
    Posted 1 year ago #

    Hi all,

    I'm having problem with loading the_editor via ajax. is there any solution?

Topic Closed

This topic has been closed to new replies.

About this Topic