0
如何顯示我的代碼的Ajax響應?當我用async=true
顯示的yy
值只是最後一個值;我需要顯示從0
到a
的所有值。它適用於async=false
。這裏是我的代碼:Ajax響應沒有顯示在成功函數內
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
});
}
同步Ajax請求的循環?這真的會凍結瀏覽器,你應該考慮另一種方式。 – Marc
因爲我需要所有的jj值,它試着同步 – venkat
我不知道你的Select.php究竟做了什麼,但是簡單地修改Select.php來返回一個字符串數組並將for-loop在成功功能? – Naning