javascript - recursive ajax calls not executing script included inbetween the recursion -
i have recursive ajax call work (php script called job, recursion working, fine) except in between ajax calls try update input text value show progress , updates once whole loop done.
why line
$('#start_'+code_regional).val(msg);
not executing ?
function addleads(code_regional, phone_numbers_start) { var databases = []; var file = document.getelementbyid('file_'+code_regional).files[0]; var formdata = new formdata(); formdata.append('selecteddatabases', json.stringify(databases)); formdata.append('code_regional', code_regional); formdata.append('phone_numbers_start', phone_numbers_start); formdata.append('phone_numbers_end', $('#end_'+code_regional).val()); formdata.append('filepath', file); $.ajax({ type: 'post', url: 'execute.php', data: formdata, processdata: false, contenttype: false, success: function(msg){ $('#start_'+code_regional).val(msg); if(msg < $('#end_'+code_regional).val()) { addleads(code_regional, msg); } else { $('#start_'+code_regional).val($('#end_'+code_regional).val()); } } }); }
if msg
integer, should compare integers instead of strings:
if( parseint(msg,10) < parseint($('#end_'+code_regional).val(),10) )
if it's still failing, try add console.log(...)
before , after test know what's going on.
Comments
Post a Comment