I have a form, which add some data to DataBase.

 <input type="text" name="mydata" />
 <textarea name="mytext"></textarea>
 <?php echo JHtml::_( 'form.token' );?>
 <button type="submit">Submit</button>

Clicking Submit, I send data to outside script, which insert data to DB. I'm checking session token (to prevent csrf attack) and then make script actions. To do this, I use Joomla JSession method checkToken().

define( '_JEXEC', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../..' ));

require_once ( JPATH_BASE. '/includes/defines.php' );
require_once ( JPATH_BASE. '/includes/framework.php' );

$mainframe = JFactory::getApplication('site');

$session = JFactory::getSession();
$session->checkToken() or die('Access denied');

That's all good, when script look like above.

But when I init TinyMCE plugin for textarea, using tiny.cloud docs, I have "Access Denied" response from script.

1 Answer 1


Found answer. The problem, that TinyMCE have own submit function and submit form independently of my ajax. Add

setup: function(editor){
 editor.on('submit', function(){
  return false;

to tinymce init config and tinymce.triggerSave() before Ajax function, and it will be all good.

  • Please accept your answer so that this page is deemed resolved by the system and it stops getting "bumped". Commented Aug 11, 2019 at 7:54
  • you have been on this site in the last couple of weeks. Please take a second to award your answer the green tick. Commented Aug 13, 2020 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.