blueimp의 파일 업로드 사용 Ajax 요청 성공 후 파일 업로드를 어떻게 트리거합니까? fileuploadsubmit을 실행하려고 시도했지만 데이터가 정의되지 않았다고 표시됩니다.Blueimp 성공적인 Ajax 요청 후 Fileupload 트리거 제출 버튼
HTML :
<form id="add-project-form" method="post" action="http://localhost/project/add/">
<p>
<label for="project">Project Name:</label>
<input id="project" class="input-text" type="text" name="name" />
</p>
<p>
<label for="overview">Project Overview:</label>
<input id="overview" class="input-text" type="text" name="overview" />
</p>
<p><input type="submit" value="Add Project" />
</form>
<form id="logo-upload" method="post" action="http://localhost/project/upload/" enctype="multipart/form-data">
<p>
<input type="file" name="logo" id="logo" />
</p>
</form>
jQuery를 :
$('#logo-upload').fileupload({
dataType: 'json',
maxNumberOfFiles: 1,
autoUpload: false
}).on('fileuploadsubmit', function(e, data) {
console.log(data);
});
$(document).on("submit", "#add-project-form", function(e) {
e.preventDefault();
var data = $(this).serialize();
var url = $(this).attr("action");
$.ajax({
url: url,
data: data,
type: "post",
dataType: "json",
success: function(response) {
if(response && response.location != undefined) {
// I would want the upload to begin here
$('#logo-upload').fileupload().trigger('fileuploadsubmit');
}
}
});
});
'e.data'에 무엇이 들어 있습니까? 어디에서'.on ('fileuploadsubmit', function (e, data) {'from?) 두 번째 매개 변수를 포함해야합니까? –
아니, 그것은 나를 위해 작동 http://jsfiddle.net/eLLWN/29/ –
@KevinB 다음은'e' 객체의 스냅 샷입니다 : http://screencast.com/t/rINDI0uO'.on ('fileuploadsubmit', function (e, data) {'나는 이것을 따라 갔다 : http : //stackoverflow.com/questions/19807361/uploading-multiple-files-asynchronously-by-blueimp-jquery-file 업로드 – gwinh