Topic: File Upload - Problems with the preview
Maurizio Maimeri asked 5 years ago
Hi everybody, I'm utilizing the file-upload plugin in an edit form with existing images on the server (i make us of the "default file" option) and I want that, once that the "remove button" is clicked, a confirmation modal box should appear and, only in case of confirmation by the user, the existing file on the server will be deleted via a ajax call.
I want that the image preview shown by the plugin will be removed if, and only if, the user gives the confirmation and the operation on the server is correctly executed (returning a success value).
Unfortunately I noticed that, once the "delete button" is pressed, the preview is immediately removed.
Can anyone help me to solve this issue?
thanks a lot
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.9.0
- Device: PC
- Browser: All
- OS: all
- Provided sample code: No
- Provided link: No
Grzegorz Bujański staff commented 5 years ago
Hi.
you should use callback function. This can be helpful: https://stackoverflow.com/questions/11576176/wait-for-a-jquery-ajax-callback-from-calling-function