Hi!
Guys, I need execute Javascript during Jquery request in php.
See my code:
New.tpl
- <script src="js/jquery.js" type="text/javascript"></script>
<script>
function Save()
{
$.post
(
'index.php',
{
Action: 'Save'
}
)
}
function Message()
{
alert('JavaScript Executing!');
}
</script>
<form>
<br><input type="button" value="Massage with Jquery!" onclick="Save()"><br>
<br><input type="submit" value="Message without Jquery!"><br>
</form>
index.php
- <?php
if( !isset($_POST['Action']))
{
require_once($_SERVER['DOCUMENT_ROOT']."MeuTreinamentoPHP/smarty/templates/Controler/MySmarty.php");
$MySmarty=MySmarty::getInstance();
$MySmarty->Open('new.tpl');
}
echo "<script>Message();</script>";//It is essential that the JavaScript is called in index in this case. :?
?>
When the page Index load, the javascript work well. When I click in the button,"Message without Jquery", the javascript run too, but when I click in the button,"Massage with Jquery!", the javascript don't run.
Then I would like to know what I need change
in index to the javascript work?
Thanks for all!