Executing PHP with HTML Button using jQuery - Javascript jQuery

Javascript examples for jQuery:Form Button

Description

Executing PHP with HTML Button using jQuery

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script> 
   </head> 
   <body> 
      <button id="btnTest">Click</button> 
      <script>
    $(document).ready(function () {
    $('#btnTest').click(function () {
    $.ajax({/*from www  . j ava  2 s  .  c om*/
       type: "POST",
       url: 'ajax.php',
       data:{action:'call_this'},
       success:function(html) {
         console.log(html);
       }
     });
    })});
   
      </script>  
   </body>
</html>

Related Tutorials