Call javascript after xmlHttpRequest
Posted: Sun Nov 02, 2008 5:23 am
Hey there,
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.
just a simple scriptaculous effect. The "show" link i just put there to test, and it show's the div fine. The code also works if i just call up the function on a page, not though XHR. So is there somthing i need to do to run the javascript or what? all suggestions apricated!
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
}