I needed to call a function continuously after a time interval, so I followed the solution provided on this link.
Here is JS code.
function displayLiveLocation()
{
var location = new Array();
var currentcord = new Array();
$('input[type=checkbox][name="IMSeries[]"]:checked').each(function() {
location.push($(this).val());
var current = $(this).val();
currentcord.push($('#'+current+'_H').val());
});
copyofAutotrack(currentcord , location);
setTimeout(function() {
display();
}, 15000);
}
Here is HTML code.
<div class="checkbox">
<input type="checkbox" onclick="displayLiveLocation()" value="0358911020092058" name="IMEISeries[]" class="IMEISeriesClass[]">
<input type="hidden" value="26.79997253418,75.799194335938" id="0358911020092058_H">
</div>
There are multiple checkboxes and hidden fields with unique id similar to above one. When a checkbox is clicked, respective function starts executing at interval of 15 seconds. However, same thing happens when another checkbox is clicked, making that function execute at lesser time interval as another call to function is made. I want this function to be executed at 15 seconds only. Any help would be appreciated. Thanks in advance.
I did not know how to search this website about this, so I asked the question.