Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
in Q2A Core by
edited by

I want to use auto refresh function in class "qa-q-list" so i use ajax to load this class after a interval X , but this doesnot relaod that div part . Is any body have solution for this problem 

I am currently using this funtion 


var refreshId = setInterval(function()
}, 5500);
But above function  work but not refreshing data from database.
so i tried this one using jquery but this also not working below is the code for jquery
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
}, 10000); // refresh every 10000 milliseconds
I have also search in net i found that using jquery we can achieve that but that require module in seperate php file.
Please if anybody have any suggestion please share here.

1 Answer

+1 vote
Best answer

The funniest thing about this is to watch the seconds tick as it updates... :)

Your code is useless... you need to actually perform an ajax request:


This works for me:

    class qa_html_theme extends qa_html_theme_base
        function doctype() {
            if(qa_post_text('ajax_reload_q_list')) return;
        function html()
            if(qa_post_text('ajax_reload_q_list')) {
        function head_custom() {
            if(isset($this->content['q_list'])) {
        function() {
    function startAjaxQListRefresh() {
            function() {

    function getAjaxQList() {
        var dataString = 'ajax_reload_q_list=true';  
        var out = '';
            type: 'POST',  
            url: '".qa_self_html()."',  
            data: dataString,  
            success: function(data) {

Hi salil,

Could you please help, which find did you put the above code to achieve that?