I am trying to post a form through AJAX jQuery. The PHP script to which it points returns a JSON encoded array. But, at the receiving end on the main page JSON.parse() is not working.
Please suggest if I am missing on some file types which need to be included
Here is my code.
< script type = "text/javascript" >
  $(document).ready(function() {
    $("#send").submit(function() {
      //$("#submit_form").html('');
      $("#modal-text2").html("<img src=" + "img/loader1.gif " 
              + "/></br</br><h4>DATA VALIDATION IN PROCESS !!! PLEASE WAIT</h4>");
      $("#myModal2").modal('show');
      $.post($("#send").attr("action"), $("#send").serialize(), function(data) {
        var decode = JSON.parse(data);
        if (decode.err > 0) {
          alert("Hi");
        }
      });
      //Important. Stop the normal POST
      return false;
    });
  }); 
< /script>The JSON encoded array which is being sent back by the PHP script is:
{"err":8,"er1":1,"er3":1,"er4":1,"er5":1,"er6":1,"er7":1,"er8":1,"er9":1,"error1":"First Name is Required","error3":"Last Name is Required","error4":"Email is Required","error5":"Please Select a Gender","error6":"Date of Birth is Required","error7":"Mobile No is Required","error8":"Password is Required","error9":"Please Fill The Captcha"}
 
     
     
     
    