The solution I would use is to submit the form with ajax. However an easier solution might be to use a hidden iframe to target the form submit.
Try going back to using the first code that caused the "Flash" but then add a hidden iframe to the page and change the target of the form to point to the iframe so that the page itself won't refresh.
<form target="hiddenIframe" ....
<iframe src="about:blank" id="hiddenIframe" name="hiddenIframe" style="display:none;"></iframe>