PHP成功上传后添加HTML

时间:2019-03-01 08:27:24

标签: javascript php ajax

我有这个脚本用于上传文件。如果文件上传成功,我想显示某个HTML消息/ div。如何将其添加到脚本中?

<script>
$(document).ready(function() { 
	 $('#uploadForm').submit(function(e) {	
		if($('#userImage').val()) {
			e.preventDefault();
			$(this).ajaxSubmit({ 
				target:   '#targetLayer', 
				beforeSubmit: function() {
				  $("#progress-bar").width('0%');
				},
				uploadProgress: function (event, position, total, percentComplete){	
					$("#progress-bar").width(percentComplete + '%');
					$("#progress-bar").html('<div id="progress-status">' + percentComplete +' %</div>')
				},
				success:function (){

				},
				resetForm: true 
			}); 
			// return false; 
		}
	});
}); 
</script>

1 个答案:

答案 0 :(得分:0)

尝试成功

success:function (){

            $("#progress-bar").html("Successfully completed")
},