Communication

Javascript to PHP (and back)

Server-side PHP
<?php
   
echo strrev($_REQUEST['str']);
?>
Client-side Javascript
<script type="text/javascript" 
        src="http://yui.yahooapis.com/2.5.2/build/utilities/utilities.js">
</script>
<script>
var callback = { 
    success: handleResponse = function(o) { alert(o.responseText); }
};
YAHOO.util.Connect.asyncRequest('GET','/rpc.php?str=Rasmus', callback);
</script>
Output