Javascript frameworks are great, no matter which one you use their all built to do more, quickly.
I use Mootools for most of my JS needs, and something is I often use is the AJAX request functionality.
Today I needed to send not only HTML back, but Javascript.
Here are the steps I needed to follow to not only return my Javascript, but to attach it to my response with the Mootools function ‘$exec’
My HTML
Update
My Mootoold Javascript
Our Request Handler PHP script
< ?php
/* QUERY OUR RECORDS FROM OUR GET DATA */
$response = mysql_get_data_function($_GET);
echo($response);
?>
Final Response
After running this ‘update’ script, we will have displayed information based on our GET data in the div ‘container’, removed our update link, shown a success message, and styled everything with out response javascript, all thanks to our nifty Mootools $exec function.