I programmed an ajax file upload. After ajax is done a popup occur where the uploaded image is displayed. In this popup I can crop an area to get a thumbnail of the picture.
The problem is that if I refresh the page before I crop the image the Crop-Function won't run and I don't get the thumbnail.
For this reason I tried the following, after the ajax return is true:
// If page refresh, run the Crop-Function
window.unload = cropImage();
But if the data will be send to the server and the server sends some data back $(window).onbeforeunload
already runs. Do you have any ideas to solve that problem?