I'm using dropzone from https://www.dropzonejs.com to upload a single picture. I'm loading a html-page with the command .load of jquery like this:
$( "#showsettingsother" ).click(function() {
$('#settingscontent').load('settingscompany.html', function() {
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone($('.dropzone').get(0), {
init: function() {
var me = this;
$.getJSON(webserverurl + '?sessionid=' + sessionkey + '&settings=true&company=checkCompanyPhotoExists', function( json ) {
if(json.STATUS == 'OK') {
var mockFile = { name: "Firmenlogo", dataURL: getcompanypicture, accepted: true };
me.createThumbnailFromUrl(mockFile, getcompanypicture);
me.files.push(mockFile);
me.emit('addedfile', mockFile);
me.emit('thumbnail', mockFile, getcompanypicture);
me.emit('complete', mockFile);
}
});
},
... [shortened]
}
}
}
Inside settingscompany.html I've got this:
<form id="uploadCompanyPicture" action="" class="dropzone"></form>
Now I've got a menu like this:
<ul>
<li id="settingscompany"><a id="showsettingscompany" href="#">Company settings</a></li>
<li id="othersettings"><a id="showsettingsother" href="#">Other settings</a></li>
</ul>
<script>
$( "#showsettingsother" ).click(function() {
$('#settingscontent').load('othersettings.html');
}
</script>
My problem is the following:
- I upload a picture to dropzone (image1.jpg). This works fine.
- I upload a second picture to dropzone (image2.jpg). This works also fine.
- Now I click on "Other Settings" and I click back to "Company settings".
- The result is, that it shows image1.jpg and not image2.jpg.
- When I restart the browser it shows image2.jpg.
So it displays the wrong picture. Has anybody an idea what I'm doing wrong?