JQuery $.ajax referesh and get new data

JQuery $.ajax referesh and get new data

I am using JQuery 1.7.2. I am using highchart for making live data chart. I maked one C# page where on the page load I am writing some jSON format data which I am using in another page with the help ajax call for highcharts. I will run that ajax call inside function and in success event of ajax call I will make setTimeout after 1 minute to call again function, So I will get latest data every time. Until here everything works very good.

But I have issue lets say data I am getting data only for 4 hr at every 1 minute than I keep my browser open and come next day. That time my aspx page will start with new fresh data from zero, so my highcharts should automatically remove all points and should pushing new data but it is not doing that. When I refresh my page all will start working good. Is there anyway that it should refresh by itself

My code for ajax call is as follow

  1. function recieveData() {
  2.    var pathArray = window.location.pathname.split('/');
  3.    var chart = $('#container').highcharts();
  4.    $.ajax({
  5.      url: '/' + pathArray[1] + '/HomePageChartData.aspx',
  6.      dataType: 'json',
  7.      cache: false,
  8.      success: function (data) {
  9.        chart.yAxis[0].setExtremes(data.minY, data.maxY, true, true);
  10.        chart.series[1].setData([]);
  11.        chart.series[1].name = data.lineSeriesName;
  12.        chart.series[0].setData([]);
  13.        chart.series[0].name = data.areaSeriesName;
  14.        for (var x in data.lineSeriesData) {
  15.          chart.series[1].addPoint([data.lineSeriesData[x][0], data.lineSeriesData[x][1]]);
  16.        }
  17.        for (var x in data.areaSeriesData) {
  18.          chart.series[0].addPoint([data.areaSeriesData[x][0], data.areaSeriesData[x][1]]);
  19.        }
  20.        setTimeout(recieveData, 60000);
  21.      }
  22.    });
  23.  }

My scenario is like data come between 9 AM to 12.30 PM and it remain on the database until next day 7 AM. So my highchart will get data every minute between 9 AM to 12.30 PM which is working very good without any problem. But issue when we wipe out all data at next day 7 AM and we start getting new data at 9 AM my high chart is not clearing by itself and start getting new data.

But if i refresh my browser I will get new data and it work good. So I was looking something like if we wipe all data my ajax should get alert and reload the page or clear data from highchart.

So I was looking for some event or way to do it in ajax call. Some guidance from experts.