Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
<div class="mytabelement">
     <?php     
        if($newstatus[0]['users']['status'] == 'complete'){
          echo $this -> Form -> postLink(__('update'), array(
    'controller'=>'orders','action' => 'user_satus','admin'=>false), array(
    'class' => 'uiBtn uiBtnBlue','id'=>'runloGc','title' => 'Run Logic'), 
    __('Are you sure you want update user?'));
    <?php } ?>
</div>

Above is my element data which come on everypage of my site, i just need to refresh this element every 2 minuts, without refreshing the page..? is it possible please help..!!

share|improve this question

2 Answers

here i am giving you just example.

you can change it in your way to using in response for html or Json as you want.

and i hope you will familiar with, ajax data type.

     <script>
                $(document).ready(function(){
                    Notifications();  // this will call only one time thats first body load time 
                    setInterval("Notifications()", 2*60*1000);  // this will call each 5000ms
                    //60000
                });
                function Notifications(){
var url = "http://example.com/user/list"
                    //alert("Notify");
                    $.ajax({
                        url: url,
                        success: function(data){
                            var test=eval(data);
                            $("#dii").empty();
                            for(i=0;i<test.length;i++){

                                $("#dii").append("<b>"+test[i]['name']+"</b>");
                                $("#dii").append(":");
                                $("#dii").append(test[i]['post']);
                                $("#dii").append("<br />");

                            }
                        }
                    }); 
                }
            </script>

And also for your controller action set your logic and just output the data in you.

Please let me know if i can help you more

share|improve this answer
thanks, i will let you soon.. – Siddesh Bhalke Jun 6 at 6:44
if i could help you, more pls let me know. – liyakat Jun 6 at 8:37

use jquery

setTimeout(function(){
    $.post(url,data,function(data){
        $(".mytabelement").html(data);
    });
},2*60*1000);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.