I have a code submit Form. Plz help me fix error
I have code index
- <script type="text/javascript">
- $(document).ready(function() {
- $("#login").validate({
- submitHandler: function(form){
- var name = $('#name').attr('value');
- $.ajax({
- type: "POST",
- url: "test.php",
- data: "name="+name,
- success: function(){
- $("#sao").load('test.php');
- }
- });
- }
- });
- });
- </script>
- <?php
- echo '<form action="test.php" method="post" id="login"><input type="text" id="name" /><input type="submit" id="submit" value="nhap" /></form>';
- echo '<div id="sao"></div>';
- ?>
Code test.php
- <?php
- if($_POST) {
- echo 'POSTED';
- } else
- echo 'NOT POST';
- ?>
I have entered and press the button "nhap" but I get results NOT POST. Plz help me fix this code