I'm relatively new to ajax, and i'm calling a php file with xhr. That works fine, but then im trying to add some javascript to the div that gets called up, but it doesn't seem to run any javascript i put in. This is the function that is being called.
Code: Select all
function alert_success($msg){
print '<div id="alert_success" style="display:none;">';
print '<img src="../lib/img/icons/success.png" alt="Success" />';
print $msg;
print '</div>';
print '<a href="#" onClick="$(\'alert_success\').appear(); return false;">Show</a>';
?>
<script type="text/javascript">
$('alert_success').appear();
</script>
<?php
}