title: Why the control is not getting returned from PHP file to AJAX success function?
body: <p>I'm using PHP, Javascript, AJAX for my website.</p>
  
  <p>I'm putting below only the necessary code.</p>
  
  <p>JS code(AJAX function code):</p>
  
  <pre><code>$("#btn_add_event").click(function(){
  
      var strSeriaze = $( "#formAddEvent" ).serialize();
      url = $( "#formAddEvent" ).attr('action');
      $("#btn_add_event").attr('disabled', 'disabled');
      $("#addEventErrorMsg").html('');
      $.ajax({
          url: url,
          type: "POST",
          data:  {postData:strSeriaze},
          beforeSend: function(){
              $('#loader-icon').show();
          },
          complete: function(){
              $('#loader-icon').hide();
          },
          success: function(data){
          //Control is not returning here on success from PHP file
              $('#loader-icon').hide();
  
              if(data == "Success")
              {
                  $("#myModal-add-event").modal('hide');
                  $("#myModal-add-event").hide();
                  window.location.href = site_url + "event_index.php";
                  return false;
              }
              else
              {
                  $("#btn_add_event").attr('disabled', false);
                  $("#addEventErrorMsg").show();
                  $("#addEventErrorMsg").html(data);
              }
          },
          error: function(){}
      });   
    }) 
  </code></pre>
  
  <p>I tried to debug the issue the call is going perfectly to PHP file, the logic written over there is also working but the control is not getting returned to the js file(i.e. AJAX success function). In turn I'm unable to execute code written inside success function. </p>
  
  <p>Please correct the mistake I'm making in my code.</p>
  
  <p>Following is the necessary PHP code after execution it is expected to return the control to js file(i.e. AJAX success funtion) but it's not happening.</p>
  
  <pre><code>if($ret) {
    $eventAddResultArr = $objEvent-&gt;GetResponse();
  
    if($eventAddResultArr['msg'] == 'Success') {
      echo "Success";
      exit;
    //From here it is expected to return the control to js file's AJAX success function but it's stopping execution here only
    } else {
      $errMsg = "";
      foreach($eventAddResultArr['msg'] as $key =&gt; $err_msg) {
        $errMsg .= $err_msg."&lt;br&gt;";
      }       
      echo $errMsg;
      exit;
    }
  }
  </code></pre>
  
  <p><strong>Note :</strong> I've put in comments in my code to make you understand my issue better. Still if you need any further information regarding the issue I'm facing please do let me know.</p>
  
  <p>Thanks.</p>