Unless I'm understanding the question wrong, it seems like you want to a call to a CGI script to return with just a pop-up alert and not affect the actual page it was called from. AFAIK, this isn't possible, since once the request has been made to the script, the browser expects a new page, that is, full HTTP headers to be printed. If you're going as far as that, you've effectively trampled the idea of avoiding "reloading the whole page with an error message."