I know this is an old post and u must have found ur way out by now, but just updating the post for future followers who,like me ,came upon this post.
1. Prefetching the image when the page loads.
2. set the innerhtml when the page loads and hide the div, and toggle the display/visiblitiy property when u submit.
Hope this helps..