I have a table and I have buttons in every row. if I disable setinterval everything works fine but when I start setinterval I only load page any buttons not working.
<script src="folder/js/jquery-2.1.4.min.js"></script>
<script>
$(document).ready(function() {
var refreshId = setInterval(function() {
$("#refresh").load(location.href + ' #refresh');
}, 1000);
$("#acceptOrderButton").click(function(event){
clearInterval(refreshId);
alert ("in");
});
});
If I disable Set interval and clear interval I see the alert on button click. What can be the problem?
My Button is inside div. So the problem is it. Is there nay way to do it?
<body>
<table id="refresh">
<tr>
<td>
<button id="acceptOrderButton">click</button>
</td>
</tr>
</table>
</body>