 <p>If you want your AJAX request to retrieve and execute code, use <code>dataType: 'script'</code>.</p> <p>Appending script to the DOM isn't going to do anything.</p> <p>See the <a href="http://api.jquery.com/jquery.ajax/" rel="nofollow">documentation</a>:</p> <blockquote> <p><strong>dataType</strong>:<br> ...<br> "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true. Note: This will turn POSTs into GETs for remote-domain requests.<br> ...</p> </blockquote>