Ajax answer not showing inside success function

How to display ajax response of my code? When I used async=true , the yy value shown is just the last value; I need to show it for all values ​​from 0 to a . It works fine with async=false . Here is my code:

 for(var jj=0;jj<a;jj++){ var yy=jj; var ins=12 var rou=13 /* */ $.ajax({ type:"GET", url:"Select.php", async:false, data:"rou="+rou+ "&ins="+ins, success : function(t){ $("#truk"+yy).text(t); // Response not shown here } //success }); } 
0
source share
1 answer

But anyway, this is the result of the ajax call you are looking for:

 var syncResult = $.ajax('/echo/json/', { async: false }); document.write(syncResult.responseText); 

See here: http://jsfiddle.net/alligator/6MsuZ/

0
source

Source: https://habr.com/ru/post/900105/


All Articles