XML : Ajax call won't work when onclick is present

I am submitting a form with a textarea in it that will get saved by a php script. I am doing this via ajax (below) but also calling onclick another javascript function. The ajax call won't work if the onclick is there, while it will when it's not there. What should I do?

  <script type="text/javascript">  $("document").ready(function(){    $(".newcomment").submit(function(){      var data = {        "action": "test"      };      data = $(this).serialize() + "&" + $.param(data);      $.ajax({        type: "POST",        dataType: "json",        url: "newcomment.php",         data: data,      });      return false;    });  });  </script>    

My submit button is this:

  <input type="submit" id="button" onclick="return hideform()"  name="submit" value="Salva">    

No comments:

Post a Comment