Hi apparently when i create a function inside that scope it will not be visible outside that function. Is there another way to call resettimeline function without putting it outside the local scope? There are many other functions I need to call which is within the function ganttChart(config) and it is impossible to move them out of this function just to call them.
index.html
<!DOCTYPE html>
<html>
<head>
<title>Gantt Chart</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="chart" id="Chart" style="width: 100%"></div>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script type="text/javascript" src="ganttChart.js"></script>
<script type="text/javascript" src="app.js"></script>
<a id="myButton" href="javascript:void(0);" onclick="resettimeline()" >Click here</a>
<br/>
<a href="javascript:updateData()" >Update</a>
</body>
</html>
app.js
var data = [
{
id: 1,
title: "Request received",
action: 'from',
user: 'SAS',
start_date: "08/08/2016",
end_date: "10/08/2016",
value: 67,
// term: "Short Term",
completion_percentage: 29,
color: "#770051",
}
];
ganttChart(config);
ganttChart.js
function ganttChart(config) {
.
.
.
.
function resettimeline() {
document.location.reload();
};
}