首次加载1.data.xml
2.更新了data.xml的内容,甚至在页面刷新后其内容未更新
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
type: "GET",
datatype: "xml",
cache: false,
error: function(jqXHR, textStatus, errorThrown) {
console.log('Error fetching xml : ' + errorThrown);
},
success: function(xml) {
var myChart = new JSChart('graph', 'bar');
myChart.setDataXML('data.xml');
myChart.setAxisNameX('Number of Days');
myChart.setAxisNameY('Number of Requests');
myChart.setAxisPaddingLeft(50);
myChart.setAxisNameColor('#655D5D');
myChart.setAxisNameFontSize(9);
/* myChart.setAxisValuesDecimals(1); */
myChart.setAxisValuesColor('#9C1919');
myChart.setTitle('Request Count Status');
myChart.setTitleColor('#333');
myChart.setBarSpacingRatio(80);
/* myChart.setTitleColor('#B6C2D0'); */
/* myChart.setGridColor('#5D5F5D'); */
myChart.draw();
}
});
});
</script>
3.在服务器端(servlet),我还添加了以下代码
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "private, no-store, no-cache, must-revalidate");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");