This is my JavaScript code:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
function mytest() {
var jqxhr = $.get("Home/GetMonitorData", function (data) {
$("#cpu").text(data.cpu);
$("#dspace").text(data.dspace);
$("#cspace").text(data.cspace);
$("#pf").text(data.pf);
$("#totphysical").text(data.totphysical);
$("#freephysical").text(data.freephysical);
$("#tcp").text(data.tcp);
$("#req").text(data.req);
}, "json");
}
$(document).ready(function () {
setInterval(mytest, 3000);
});
</script>
The issue is, setInterval only runs once. My program is supposed to get some WMI Information from an action method, print in on screen, and refresh these values every 3 seconds. But after one refresh, it stops. Any suggestions/ideas?