0
현재 Valums JQuery File Upload 플러그인을 사용하고 있습니다. 플러그인은 사용하기가 매우 편리하지만 코드가 어떻게 보이는지 좋아하지 않습니다. 그것은 document.ready
같은 내부 점유하기 때문에 :JQuery Ajax 플러그인 파일 업로드 코드
$(document).ready(function() {
var button = $('#button1'), interval;
new AjaxUpload(button, {
action: 'http://test.com/user/uploadfile',
name: 'myfile',
onSubmit : function(file, ext){
// change button text, when user selects file
button.text('Uploading');
// If you want to allow uploading only 1 file at time,
// you can disable upload button
this.disable();
// Uploding -> Uploading. -> Uploading...
interval = window.setInterval(function(){
var text = button.text();
if (text.length < 13){
button.text(text + '.');
} else {
button.text('Uploading');
}
}, 200);
},
onComplete: function(file, response){
button.text('Upload Finished');
window.clearInterval(interval);
// enable upload button
//this.enable();
alert(response);
}
});
});
내 질문에 코드가 더 단순화 될 수있다? 내가 코드를 가질 수 있도록 더 많거나 적은 모습처럼 : 사전에
$(document).ready(function() {
var button = $('#button1'), interval;
new AjaxUpload(button, {#leads to another function}#);
});
감사