When inserting images here, previously added images are displaying. Any solutions?
Here is my view page
<div class="col-md-2">
<form enctype="multipart/form-data" method="post" action="<?php echo base_url();?>admin_control/upload_image" id="upload-image">
<div class="form-group upload-image">
<input type="file" data-toggle="tooltip" data-placement="bottom" title="Upload Image" name="file" id="file">
</div>
</form>
</div>
<div class="clearfix"></div>
<div class="col-md-12" style="padding-left: 0px;" id="uploaded-img">
</div>
<script type="text/javascript">
$(document).ready(function (){
$('#modal-close').click();
$("#file").change(function() { $('#upload-image').submit(); });
$('#upload-image').on('submit',(function(e){
e.preventDefault();
//alert()
var formData = new FormData(this);
$.ajax({
type:'POST',
url: $(this).attr('action'),
data:formData,
cache:false,
contentType: false,
processData: false,
success:function(result)
{
//$('#uploaded-img').html(result);
//location.reload();
}
});
}));
});
I believe the issue may be related to JavaScript. I am struggling with it here...