Problem to start a script after an ajax response
I have a HTML code like this:
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Test</title>
- <meta charset="utf-8">
- <script src="js/jquery-1.9.0.js"></script>
- <script>
- $(function buttA() {
- $("#buttA").click(function(){
- alert ("Hello from buttonA");
- });
- });
- $(function buttB() {
- $("#buttB").click(function(){
- alert ("Hello from buttonB");
- });
- });
- $(function bReq() {
- $("#bReq").click(function(){
- $.ajax({
- url:"test.php",
- type:"post",
- success:function(result){ $("#b").html(result);}
- });
- });
- });
- </script>
- </head>
- <body>
- <div id="content">
- <div id="a">
- <button id="buttA">Button A</button>
- </div>
- <button id="bReq">Call Button B</button>
- <div id="b">
- </div>
- </div>
- </body>
- </html>
and a PHP code like this:
- <?php
- echo '
- <button id="buttB">Button B</button>
- ';
- ?>
Why Button B don't work ??