Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    SoS
    SoS is offline
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatic refresh every minute

    Hello.
    I'm using a modified version of http://www.javascriptkit.com/dhtmltu...xticker4.shtml
    and i need that the rss_ticker.prototype.getAjaxcontent get the content every minute.
    Could someone helps me?
    Thank you,
    Sebi

  • #2
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts
    with plain Js you need something like this:
    Code:
    function xhr(){
    var xmlHttp=null;
    try{xmlHttp=new XMLHttpRequest();}
    catch (e){
    try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
    catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
    return xmlHttp;
    }
    
    var retrieve = new xhr();
    function _retrieve(){
    retrieve.open("GET","questions_ajax.php?", true);
    retrieve.setRequestHeader('If-Modified-Since','Wed, 05 Apr 2006 00:00:00 GMT');
    retrieve.send(null);
    retrieve.onreadystatechange = function(){
    if (retrieve.readyState == 4 && retrieve.status == 200) {
    response= retrieve.responseText
    document.getElementById('output').innerHTML = retrieve.responseText;
    window.setTimeout('_retrieve();',1000)
    //alert(response.length)
    
    				}
    			}
            }
    
    onload=function(){
    _retrieve()
    
    }
    then in questions_ajax.php you have your database query.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •