I have a function which needs to be run 197 times.I used a simple for loop to iterate it.
for(var m=0;m<198;++m) {
console.log($('#riddle').attr('index')+" "+$('#riddle').attr('word'));
submitN();
}
For each iteration this should print the Index and Word attribute of Id=riddle and then execute the submitN function which changes the Index and Word attribute.
However The function executes only once.
If I execute the submitN seperately function without loop for 197 times , it works fine
Pressing the key 197 times is a very inefficient, I would like some help to make it run with the loop.
EDIT
submitN function
function submitN() {
var i_val = $('#riddle').attr('next');
req_n = sendData(JSON.stringify({'i':i_val}),'/clue');
req_n.done(munchClues);
req_n.fail(clueFail);
}