Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
ckeditor - how to do an onchange from the editor to a php function

I need to call a php function from I suspect an ajax call. I have ckeditor and need to trap any keyboard movement and think onchange will do that. I then need to run a function to stop a timeout from happening, as I suspect the program can timeout if the user is staying in the editor too long.

 <textarea required cols='80' rows='9' class='ckeditor' name='email_text_editor' id='email_text_editor1' placeholder='Body text' onchange='updateTimer(this.value);'><?PHP print $email_subs_rem; ?> </textarea>


                                function updateTimer(myValue) {
                                    //sessionTimeoutUpdate();// php function
                                    //console.log(myValue);
                                    //$.ajax({
                                    //    type: "GET",
                                    //    url: "dummy.php",
                                    //    data: "mainid =" + id,
                                    //    success: function(result) {
                                    //        $("#somewhere").html(result);
                                    //    }
                                    //});
                                }
                            </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can do something like this...

function updateTimer(myValue) {
     //sessionTimeoutUpdate();// php function
     console.log(myValue);
     $.ajax({
         type: "GET",
         url: "dummy.php",
         data: {"mainid =" + id, action : "updateSession"},
         success: function(result) {
           $("#somewhere").html(result);
         }
       });
     }

PHP file

<?php 
   if(isset($_GET['mainid'])){
      if($_GET['action']== "updateSession"){
          sessionTimeoutUpdate();//function you wanna call
      }
   }
   
   function sessionTimeoutUpdate(){
      //Do your task here
      //After done
      echo "done";
   }
?>

Since there is no way you can directly call a php function at client side without request, AJAX is very useful here.

Comment down for any queries.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!