Below is the peice of code in my project. The issue is that, whenever I'm calling function getLinks(), the ajax call gets the array data and printing only in "plots" div. The "graph" div is skipping out.
The ajax call is getting the data based on tabs correctly, but only issue is not printing in respective div.
Can please explain me what I'm missing here.. ??
getLinks() {
var tabs = ['graph','plots'];
var t = 0;
for(t=0; t<tabs.length; t++) {
var currentTab = tabs[t];
var d = 0; var li = "";
$.ajax({
type: "post",
url: 'url'+currentTab,
success: function(data) {
// 'data' will be group of array variable
for(d=0; d<data.length; d++) {
var id = data[d].id;
var label = data[d].label;
li = "<li><a href='/"+currentTab+"?product="+currentTab+"&id="+id+"'>"+label+"</a></li>";
$("#"+currentTab).append(li);
}
}
});
}
}
<div id="graph"></div>
<div id="plots"></div>