Added a callback method on the Ajax Post method to wait for the file generation before downloading it