Yes, I know. It's impossible to call a PHP function directly from JS. But that doesn't mean we can't cheat a bit!
...you don't want that ugly iframe hanging around, visible to your users, so you can close it by removing the node.
Here's a dirty example:
//create a js variable that contains the url and js variables to be passed.
//insert this as the value of the .src property of your iframe element:
//next, remove the element node from the document so the users won't see the iframe.
The quickest, cleanest next step was to pass this data directly (or as closely thereto) to a php script, unnoticed by the user, for server-side processing.
A return from the php script to the client browser can be made ie,
?><script>alert("A user name is required");</script><?