서버에서 처리 할 거대한 파일이 있습니다. 파일을 서버에 업로드 한 다음 읽어서 배열을 만듭니다. '진정한 비동기'잠금 여기에jQuery ajax async locks 브라우저
function getXMLFile(file){ // Single call
$.ajax({
url: '....',
type: 'post',
dataType: 'json',
data: {filename: file},
success: function(json){
$.each(json, function(key, value){ // iterates over 50 000 items.
tmp.push(value);
i++;
if(i > 10000){
setTimeout(function(){
insert(tmp);
tmp = [];
i = 0;
}, 1000);
}
});
}
});
}
및 기능 : 내 브라우저 있도록에서는 setTimeout을 사용
function insert(data){ // called from getXMLFile() @data -> array of 10 000 code entries
$.ajax({
url: '....', // for now php function does nothing.
type: 'post',
dataType: 'json',
data: {codes: data},
async: true // !!!!
});
}
});
당신은 내가이 볼 수 있듯이을 지금은 다시 서버로 정보를 둘 필요가 잠기지 마라. 하지만 여전히 잠겨 있습니다 ... 내가 잘못 했나요?