Ok, so this should be easy right? test.php:
function some_javascript() {
echo "Hello";
echo "<script type='text/javascript'>alert('Hello')<script>";
}
and you'll get an alert window when you try to load your test.php.
I must be missing something because I can't get this to work using a modal window as target and an AJAX request via post.
Here's a basic structure of what I'm trying to do:
index.html:
<html>
<head>
<style>
#modal {
visibility:hidden;
}
</style>
</head>
<body>
<div id="modal">
</div>
<button onclick="call_ajax();">Call Ajax</button>
</body>
</html>
call_ajax() sets modal visibility to "visible" and its innerHTML to response text from test.php(I don't write code because I don't seem to have problems here; text is sent just fine (I get "hello") and post data sent is processed as needed). But no alert window! Instead I get "alert('Hello')".
Other than that the code works fine but I can't get javascript to work. There must be some detail I'm missing. Any ideas????