I can't believe that you guys all have the same problem, and I don't even get what it's about. Have the PHP script generate an alert? Why would you want to do that? That's the most user-unfriendly type of server-side validation I can think of.
And even if you really want to do it, although it's certainly a silly thing to do, what's the problem, really? Just let your PHP script write out the Javascript; there's nothing to it.
Edit: I just reread the original post and saw that this is about AJAX, and I get it even less now. You can do whatever you want in the AJAX callback, so why not just alert something, if you feel that's what you must do?