title: I cant get response from json encode
body: <p>I am trying to get values from form with serialize function and I correctly post and save to database but after this step my codes don't work . Someone help please ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> $(document).ready(function() {
         $("#kform").submit(function() {
           var data = $(this).serialize();
  
           $.ajax({
             type: "POST",
             url: "yenikayit2.php",
             data: data,
             dataType: "json",
             success: function(data) {
               if (data.tip === "dosya") {
                 alert("tralalala d");
               }
               if (data.tip === "tercume") {
                 alert("tralalala t");
               }
               if (data.tip === "hata") {
                 alert("tralalala hata");
               }
             }
  
  
  
           });
  
  
         });</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>PHP Code</strong></p>
  
  <pre><code>&lt;?php
  
  if($musteri_ekle) { //mysql control function
  $musteri_id=mysqli_insert_id($baglanti);
  $_SESSION[ 'musteri_id']=$musteri_id;
  if ($secilen=="dosya" ) 
  { echo json_encode(array( "tip"=&gt;"dosya")); }
  else if ($secilen == "tercume") 
  { echo json_encode(array("tip"=&gt;"tercume")); } }
  else { echo json_encode(array("tip"=&gt;"hata")); } ?&gt;
  </code></pre>