Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to refresh ol list using jquery?
Posted

1 solution

Take one div.
inside that take Olist.

now get your data from jquery/ajax and when you get the data clear the content of div and bind new Olist dynamically with new data.

Ex to clear your idea...
HTML
<div id="MyDiv">
   <ol>
       <li>
       ...
       ...
       </li>
   </ol>
</div>

Now get data from ajax.
JavaScript
setInterval(function () {

$.ajax({
   type: "GET/POST",
   url: "YourUrl",
   dataType:"json",
   success: function(data){
      $("#MyDiv").empty();
      $("#MyDiv").append('<ol><li>'+data+'</li></ol>');
   },
   error: function(){
      alert("error");
   }
}, 10000);

});

//This will refresh the page at 10sec interval of time


Hope This Help You
--------------------
Pratik Bhuva
 
Share this answer
 
v5
Comments
amnk.info 8-Nov-13 2:27am    
i'm using mysql view to get data.. then how to do this task?
Pratik Bhuva 8-Nov-13 3:35am    
in URL:"" write the name of your page/mehtod and send whatever data you want to send.
i don't know much about PHP so i can't tell you how to handle this thing from back end.
But explore about ajax call in PHP.
the front end code will work fine cause i am using this in my project currently.
you just need to send json data from server side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900