Home > Web Front-end > JS Tutorial > ajax caching problem requestheader_javascript skills

ajax caching problem requestheader_javascript skills

WBOY
Release: 2016-05-16 18:22:03
Original
1759 people have browsed it
Copy code The code is as follows:

var paras="ajaxFlag=getMarkerIDs";
var myAjax= new Ajax.Request(
"AddInfoHandler.ashx",
{method:'get',parameters:paras,onComplete:showGetMarkerIDsResponse}
);

because I have a When switching databases, when entering database A for the first time, the list is loaded correctly. Clicking on the node (ajax) map displays the A data, but clicking IE to go back and then entering the treeview of database B, the list is loaded correctly (the loaded list is not ajax). When I clicked on the node map, the data displayed was still the data of A (ajax). I set a breakpoint in AddInfoHandler.ashx and found that when I performed the above operation again, the breakpoint was hit when entering database A, but the breakpoint was not entered when entering database B, but I It's really strange. Ajax returns data even if the page is not entered, and it is the same as last time. It should be a caching mechanism. Finally, the information found online has changed as follows:
Copy the code The code is as follows:

var myAjax=new Ajax.Request(
"AddInfoHandler.ashx",
{method:'get',requestHeaders: ['Cache-Control','no-cache','If-Modified-Since','0'] ,parameters:paras,onComplete:showGetMarkerIDsResponse}
);


For the following, you can refer to previously published articles
http://www.jb51.net/ article/22074.htm
Introduction to response.setHeader parameters and usage
Detailed source reference:http://www.jb51.net/article/16437.htm
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template