Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda