var started = false; $(document).ready(function () { $('#start').click(function () { var count = $("#list").val(); var line = count.split("\n"); started = true; line.forEach(function(value, index) { setTimeout( var ajaxCall = $.ajax({ url: url, type: 'GET', data: someData, success: function(result) { //some works here } }); $('#stop').click(function () { ajaxCall.abort(); //abort Ajax $('#check').attr('disabled', false); $('#stop').attr('disabled', 'disabled'); }) }, 2000 * index); }); }); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)