0
그냥 PHP 스크립트 파일의 responseText를 div에 추가하려고합니다. div의 내용을 바꾸지 말고 responseText를 기존 div 내용에 추가해야합니다. responseText는 태그입니다.ajax와 jquery를 사용하여 PHP 파일에서 div로 응답 태그를 추가하는 방법
$(document).ready(function() {
var options = {
beforeSend: function() {
$("#progress").show();
//clear everything
$("#bar").width('0%');
$("#message").html("");
$("#percent").html("0%");
},
uploadProgress: function(event, position, total, percentComplete) {
$("#bar").width(percentComplete+'%');
$("#percent").html(percentComplete+'%');
},
success: function() {
$("#bar").width('100%');
$("#percent").html('100%');
},
complete: function(response) {
$("#message").append("<font color='green'>"+response.responseText+"</font>");
//DOESN'T WORK
},
error: function() {
$("#message").html("<font color='red'> ERROR: unable to upload files</font>");
}
};
$("#uploadForm").ajaxForm(options);
});
대신 responseText를 추가하기 위해 메시지 div의 내용을 대체한다는 의미입니다. –