ranjit thorat
ranjit thorat

Reputation: 173

Jquery ajax form submission even after return false?

I am sending data ,collected from form on same page,for insert query through ajax to a php page which return success/fail .But instead of ajax call, my form is getting submitted even after return false .my form field name values are same as that of ajax post filed data names.there is no error on php page as i tried actual form submission and it worked. Why even after return false my form is submitted. there is some error in console but it loses when page is refreshed.

here is my form field

<form method="POST" action="manuAthuntication.php" id="myform" onsubmit="return editAdmin()">

j query code

<script>
                  function editAdmin(){
                      
                       console.log("Here"); 
                       var aname=$("#aname").val();
                        var aemail=$("#aemail").val();
                       
                        var depname=$("#depname").val();
                        var acontact=$("#acontact").val();
                        var adesi=$("#adesi").val();
                        var apass=$("#apass").val();
                      
                         /* var myInput = document.getElementById('did');*/
                            /*myInput.disabled = false;*/
                           var hdid=$("#hdid").val();
                           var haid=$("#haid").val();
                          // $('#aidd').val(uid);
                          // var uid = sessionStorage.getItem("adminidedit");
                          $.ajax
                                    ({
                                            type:'post',
                                            url:'manuAthuntication.php',
                                             data:{
                                                editAdmin:"editAdmin",
                                                aname:aname,
                                                haid:haid,
                                                aemail:aemail,
                                                depname:depname,
                                                acontact:acontact,
                                                adesi:adesi,
                                                apass:apass,
                                                hdid:hdid
                                           },
                                           success:function(response) {
                                                   if(response=="success")
                                                       {
                                                         // console.log(" succes here");
                                                         $("#error").text(" added succesfully");
                                                       }
                                                       else
                                                       {
                                                          // console.log("here");
                                                         $("#succmssg").text("ID already exist. choose new one");
                                                        
                                                       }
                                             }
                                    });
                             

                        
                              return false;
                             
                  }          
                              </script>

Upvotes: 1

Views: 106

Answers (1)

Ranjeet Thorat
Ranjeet Thorat

Reputation: 170

In chrome you can open developers tool and under network check on preserve log options.

Upvotes: 1

Related Questions