You could do it in jQuery, but I actually think that it’s better to validate the POST var in PHP and then execute the snippet as you’re doing now (server-side validation is always better than client-side imho).
I think you’d either need to use jQuery’s Ajax functions (which have callbacks) or set some DOM element that jQuery can access the value of in order to do it using jQuery. But if you’re gonna do that, you may as well set the visibility of the div at that point instead of passing the command to jQuery to execute. I use snippets like this to pop up modals with info after a submit in some cases, and I just use a snippet to insert the code when necessary.
Not everything needs to be Ajax. Some things are better kept simple. If you can make a contact form send message, validate input, and weed out spambots you’ve accomplished the mission as far as I’m concerned.