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 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    96
    Thanks
    8
    Thanked 1 Time in 1 Post

    Check document if updated

    Hi,

    I want to make a Javascript function that checks the server for the last news date every X of time, I will handle the server side issue but I need guys to help me with this.
    Thank you.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    You need to use some Ajax requests to get data from serverside via javascript.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Dec 2007
    Posts
    96
    Thanks
    8
    Thanked 1 Time in 1 Post
    I already know that , how can I write/use ajax request ?because im a php programmer not Javascript

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    i'm not saying the posted solution won't work, but it seems a little overkill.

    try this:
    Code:
        function fileDate( url ) {
            var XHRt =  !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
            XHRt.open("HEAD", url, false);
            XHRt.send('');
            return XHRt.getResponseHeader("Last-Modified")
        }
    
    
    //test for firebug:
    alert( fileDate( location.href ) )
    most, but not all, http servers will include the last-modified header, so if this works for you and your host, you won't be needing any server-side scripts.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5


  •  

    Posting Permissions

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