$.getScript 순차 로딩

1 개요[ | ]

Load Javascripts Synchronously Using jQuery
$.getScript 순차 로딩
function loadScripts(scripts, index, callback) {
	$.getScript(scripts[index], function() {
		if(index+1 <= scripts.length-1) {
			loadScripts(scripts, index+1, callback);
			return;
		}
		if(callback) callback();
	});
}
var myScripts = ['//example.com/script1.js', '//example.com/script2.js', '//example.com/script3.js'];
loadScripts(myScripts, 0, function() {
	// 모두 로딩됨
});

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}