Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda