I have written servlet which actually writes bytes of an image into the response. I am able download the image by submitting form with action get or post to servlet. But how can I request this servlet without leaving the page?
I tried jQuery.get("http://localhost:8080/mydownloadservlet"). Request is getting received in servlet but image is not getting download. Same is working with form submit.
Thanks,
Amit Patel
Following worked.
Created hidden iframe.
and using jquery downloaded the image by setting src of hidden frame as follows.