I'm sending out AJAX request for a XML file to plot a chart. The problem is everytime the response comes back, the chart refresh itself, even if the XML is exactly the same.

I would like to use Javascript to check the content of the reponse XML with the cached XML, and only push to the chart if there are changes, dont do anything if it's the same.

How do I retrieve the cached XML?


Newvermind I finally got it.

if (i != 0) // if not 1st run
   currentXML = newXML;

newXML = xmlhttp.responseText;
i = 1;

if (newXML != currentXML) // if XML content changes
  ...plot the chart...