title: CKEditor returning empty data on first request and works on every other request
body: <p>I have CKeditor setup in my app like this:</p>
  <pre><code>if ($('#disputeTextarea').length) {
          CKEDITOR.replace( 'disputeTextarea' );
  
          $('#dispute-post-msg').click(function() {
              $.poseidon('#dispute-msg-form', {
                  method: 'post',
                  data: {
                      'message': $('#realTextarea').val(),
                      'app_csrf_token': $('input[name=&quot;app_csrf_token&quot;]').val(),
                      'uri': $('input[name=&quot;uri&quot;]').val(),
                  },
                  onBeforeSend() {
                      for ( instance in CKEDITOR.instances ) {
                          CKEDITOR.instances[instance].on('change', function ()
                          {
                              var editorName = $(this)[0].name;
                              CKEDITOR.instances[editorName].updateElement();
                          });
  
                          document.getElementById('realTextarea').value = CKEDITOR.instances[instance].getData();
                      }
                      return true;
                  },
                  onSuccess(data) {
                    //handle success event
                  }
              });
          });
      }
  </code></pre>
  <p>The PHP script handling the submission of the posted data:</p>
  <pre><code>public function send_message($dispute_id, $uid) {
              if ($this-&gt;input-&gt;is_ajax_request()) {
                  $message = $this-&gt;db-&gt;escape_str($this-&gt;input-&gt;post('message'));
                  $uri = $this-&gt;db-&gt;escape_str($this-&gt;input-&gt;post('uri'));
              
                  if (empty($message)) {
                      exit(json_encode([
                          'response'  =&gt;  false,
                          'message'   =&gt;  'Message field is empty.'
                      ]));
                  } else {
                      // Insert message into db
                      $this-&gt;db = $this-&gt;load-&gt;database('disputes', TRUE);
                      $this-&gt;db-&gt;set([
                          'id'    =&gt;  $this-&gt;_generate_id('messages'),
                          'dispute_id'    =&gt;  $dispute_id,
                          'author'        =&gt;  $uid,
                          'message'       =&gt;  htmlentities($message),
                      ]);
  
                      $update = $this-&gt;db-&gt;insert('messages');
  
                      if ($update) {
                          exit(json_encode([
                              'response'  =&gt;  true,
                              'message'   =&gt;  'Your message was successfully posted.',
                              'url'       =&gt;  '/'. $uri
                          ]));
                      } else {
                          exit(json_encode([
                              'response'  =&gt; false,
                              'message'   =&gt; 'An error occurred while trying to send your message, please try again later or contact support if the problem persists.'
                          ]));
                      }
                  }
              } else {
                  show_404();
              }
          }
  </code></pre>
  <p>The View containing the form with CKeditor:</p>
  <pre><code>&lt;div class=&quot;row&quot;&gt;
                      &lt;div class=&quot;col-lg-12 col-md-12&quot;&gt;
                          &lt;?= form_open('disputes/{dispute_id}/message/send/{cur_uid}', 'class=&quot;form-group&quot; id=&quot;dispute-msg-form&quot;'); ?&gt;
                              &lt;input type=&quot;hidden&quot; disabled=&quot;&quot; name=&quot;uri&quot; value=&quot;{uri}&quot; /&gt;
                              &lt;textarea id=&quot;disputeTextarea&quot;&gt;&lt;/textarea&gt;
                              &lt;input id=&quot;realTextarea&quot; type=&quot;hidden&quot; name=&quot;message&quot; /&gt;
  
                              &lt;button style=&quot;margin: 20px 0;&quot; id=&quot;dispute-post-msg&quot; class=&quot;btn btn-info mr-1&quot;&gt;&lt;i class=&quot;ft-key-square ticket-options-icon align-middle&quot;&gt;&lt;/i&gt;
                                  Post Message
                              &lt;/button&gt;
                          &lt;?= form_close() ?&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  </code></pre>
  <p>The result I get after submitting the form the first time:
  <a href="https://i.stack.imgur.com/DTkrB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DTkrB.png" alt="CKeditor form" /></a>
  The form's POST data doesn't include the <code>message</code> field in the first request, but on other subsequent requests it's added. Debugging is kinda tricky and for the life of me I can't get it to work. I'm using CodeIgniter 3.1.1 and PHP 7.4.8</p>