In PHP you could just have an inline script in the html tag. I am not sure I understand why you are using a hidden field though. Why not have a hidden div that you change the CSS display property on? <div id="errorNotice" style="display:none;">Everything is Fine</div>
Change the display property to block to have it show on the page. You can use a querystring variable or just print directly to the page a on off switch in the javascript code.
var aOK = <?php echo "1"?>;
You can put some if then logic in there to check for any variable you like in PHP. Then when they page is loaded in the browser PHP has printed the variable into the javascript.