我在同一页面中有以下javascript和ajax函数 - 我希望在第一个函数被激活并完成时激活ajax dis()函数
<script src="//code.jquery.com/jquery.js"></script>
<script type="text/javascript">
function addStock(event) {
var element = event.target;
var symbol = element.getAttribute("symbol");
if (confirm("Add Symbol to Watchlist " + symbol + "?")) {
$.post("watchlistinsert.php?symbol="+ symbol");
console.log("item " + symbol + " added");
//Here i want to call the function dis()
} else {
console.log("user canceled");
}
return;
}
</script>
function dis()
{
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET", "select.php",false);
xmlhttp.send(null);
document.getElementById("getdata").innerHTML=xmlhttp.responseText;
}
dis();
setInterval(function(){
dis();
},10000);