Show popup only when page itself receives a POST form submission on the server side?

Show popup only when page itself receives a POST form submission on the server side?

This isn't strictly a jQueryMobile client side only app, but so far the problem appears to be on the jQueryMobile side. I debugged with developer tools (element explorer and network monitor) and it looks like the DOM gets updated correctly upon page POSTing back to itself and I see the correct intended HTTP response HTML sent back by the server. But page doesn't render with popup showing as desired upon form submission to itself.

Form post back to itself done with PHP on the server side, manipulating the status of the page DOM as needed for jQuery mobile to then render at client side.

Here's what I have so far:  https://gist.github.com/daluu/5996561

Is my logic incorrect, missing something, or there's sort of a jQuery mobile bug here?

Could it be browser client side caching causing problems? The popup message is updated correctly but the injected "show popup" script doesn't seem to execute (or execute properly), since on initial page load (before form submission) that script snippet is not injected.

In a nutshell I just want to programmatically show the popup only on page load when the page on the PHP server side has received a form submission, otherwise don't show.