Ajax Load Page Server returns 304 not Modified_ajax related

Source: Internet
Author: User
Now that your server is returning 304 not modified

That means that you have not modified the XML file on the server, or the page to be loaded has not been modified locally, the local cache has caused this problem

A common way to prevent caching is to add a random number to the back, or you can add a timestamp

Like when you ask.

url = "... xml?t=" + (New Date () ()). GetTime (). toString ();

The method I used in this example:
Copy Code code as follows:

var destination= "test.html"

function goto (destination) {
var ajaxobj=new ajaxrequest; Create Ajax object, class in just that file.
Ajaxobj.method= "Get"; Set the request mode to get
ajaxobj.url=destination+ "? t=" + (new Date ()). GetTime (). toString (); The URL of the response, which can be changed to some dynamic processing page, will be known with Ajax, which can be used to return different data in the page
Set the callback function to output the response content because it is a static page (this is my requirement) so everything is coming up.
Ajaxobj.callback=function (xmlobj) {
document.getElementById (' page_content '). InnerHTML = Xmlobj.responsetext; But you have to watch this sentence!
}
Ajaxobj.send (); Send Request
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.