A developer recently told me I could make ajax requests to php pages, have them return javascript methods and then have the client execute those methods. How is this done? A link to a relevant resources would be great too.
Edit
5 years wiser, I would now try pretty hard never to do this. Any mechanism of this kind opens too much risk of cross-site scripting attacks. It's far safer to disable all inline javascript using appropriate headers, and find another way to achieve the desired functionality. If dynamically generated scripts are really required, they can be assembled on the server and included as external scripts:
<script src=/dynamic-script.php?param1=blah¶m2=ayyylmao></script>
In this example dynamic-script.php would use the parameters passed to it to generate the required javascript.
<script>element pointing to your PHP script and insert it in your DOM.