How do I make a change to be printed in the view without refresh?

Asked

Viewed 125 times

0

<script type="text/javascript">

  function atualizarTarefas() {
       var url = "institucional";
       jQuery("institucional#entregas").load(url);
   }
   setInterval("atualizarTarefas()", 1000);

</script>

1 answer

0


It’s simple:

On your call load in Javascript use the function site_url() from the Url helper to pass the correct link to the controller function.

Javascript

$("#minha_div").load("<?=site_url('institucional/tarefas/')?>");

Controller

class Institucional extends CI_Controller {

     public function tarefas() {
        echo "Seu conteúdo";
     }
  }

or

class Institucional extends CI_Controller {

    public function tarefas() {
       $this->load->view("listagem_tarefas");
    }
 }

https://www.codeigniter.com/user_guide/helpers/url_helper.html

  • thanks! Even Valew worked out here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.