SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Header problem

  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Header problem

    Hello. I request header info of a file that is on my server via ajax call.

    xmlhttp = new XMLHttpRequest();
    xmlhttp.open("HEAD","http://www.example.com/ht.hmtl",true);
    xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
    alert(xmlhttp.getAllResponseHeaders())
    }
    }
    xmlhttp.send(null)
    I edit the html and execute the above code again but the same header response is sent by the server. Change isnt grabbed by the ajax call. Is it a server problem or am I doing sth wrong in the code?

    Thanks in advance.

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ajax simply requests data like a browser. It can also cache the response.

    try

    Code javascript:
    xmlhttp = new XMLHttpRequest();
    var url = "http://www.example.com/ht.hmtl" + new Date().getTime();
    xmlhttp.open("HEAD",url,true);
    xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
    alert(xmlhttp.getAllResponseHeaders())
    }
    }
    xmlhttp.send(null)


  3. #3
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh God. Didnt know that. Thank you very much. It helped.


Tags for this Thread

Bookmarks

Posting Permissions

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