how to prevent ajax chart inside updatepanel disappear after timer tick
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick"></asp:Timer>
<div id="line-chart" style="height: 356px;"></div>
</ContentTemplate>
</asp:UpdatePanel>
protected void Timer1_Tick(object sender, EventArgs e)
{
UpdatePanel1.Update();
}
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: 'POST',
url: "Index.aspx/GetGraphData",
dataType: 'json',
contentType: "application/json; charset=utf-8",
data: {},
success: function (result) {
new Morris.Line({
element: 'line-chart',
data: result.d,
xkey: 'year',
ykeys: ['C', 'D', 'E', 'F'],
labels: ['C', 'D', 'E', 'F'],
pointSize: 3,
fillOpacity: 0,
pointStrokeColors: ['#ae521e', '#17941c', '#7b20dd', '#5d051a'],
behaveLikeLine: true,
gridLineColor: '#e0e0e0',
lineWidth: 1,
hideHover: 'auto',
lineColors: ['#ae521e', '#17941c', '#7b20dd', '#5d051a'],
resize: true,
redraw: true,
parseTime: false,
goalLineColors: ['#FF0000', '#00FF3A'],
goals: [80, 50],
goalStrokeWidth: [2],
postUnits: '%'
//preUnits: 'Use: '
});
},
error: function (error) {
alert(error.responseText);
}
});
});
</script>