PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, September 8, 2022

[FIXED] How to clean Froala editor after sending ajax data

 September 08, 2022     ajax     No comments   

Issue

I'm using Froala WYSIWYG editor, I use ajax to add comments, so I have to empty the editor when data are successfuly inserted. but it doesn't work!!!! here are my codes:

                type: 'POST',
                url: 'article_functions/add_comment.php',
                data :{ comment : comment, article : article, user : user },
                beforeSend: function()
                {
                    $('img.comment_loader').show();
                    },
                success: function(data)
                {
                    $('img.comment_loader').hide();
                    $('div#all_comments').append("// here is the inserted comment");
                    $('textarea#core').val('');
                    },
                error: function(data)
                {
                    $('img.comment_loader').hide();
                    alert(data);
                    }

As you see, I use the .val('') to clean the editor. what's the problem guys ?


Solution

You should use $('YOUR_SELECTOR').editable('setHTML', '', true);



Answered By - st3fan
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing