성공적인 업로드 또는 파일에 대해 아약스를 통해 메시지를 반환하는 작은 아약스 업로드 스 니펫입니다. upload.php에서 Iis 어디 양식 페이지로 반환되는 메시지를 포함하는 div 있습니다. divs/messages가 페이지 자체로 돌아 오는 대신 모달 창으로 반환되도록 수정하는 방법을 궁금합니다. 누군가가 나를 도와 줄 수 있기를 바랍니다. 어딘가에서 jquery UI를 사용해야합니까? 고마워, 얘들 아!AJAX 메시지를 Jquery를 통해 모달 창으로 반환
$j(document).ready(function(){
var upload = new AjaxUpload('#userfile', {
//upload script
action: '/modules/mod_artuploader/upload.php',
onSubmit : function(file, extension){
//show loading animation
//$j("#loading").show();
//check file extension
if (! (extension && /^(jpg|png|jpeg|gif)$/.test(extension))){
// extension is not allowed
$j("#loading").hide();
$j("<span class='error'>Error: Not a valid file extension</span>").appendTo("#file_holder #errormes");
// cancel upload
return false;
} else {
// get rid of error
$j('.error').hide();
}
//send the data
upload.setData({'file': file, 'userid': <?php echo $user->id?> });
},
onComplete : function(file, response){
//hide the loading animation
$j("#loading").hide();
$j("#userfile").hide();
$j('label[for="userfile"]').hide();
//add display:block to success message holder
$j(".success").css("display", "block");
$j(".picture").css("display", "block");
//This lower portion gets the error message from upload.php file and appends it to our specifed error message block
//find the div in the iFrame and append to error message
var oBody = $j(".iframe").contents().find("div");
//add the iFrame to the errormes td
$j(oBody).appendTo("#file_holder #errormes");
}
});
});
</script>