php - I cant get response from json encode -


i trying values form serialize function , correctly post , save database after step codes don't work . please ?

 $(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");               }             }                 });             });

php code

<?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"=>"dosya")); } else if ($secilen == "tercume")  { echo json_encode(array("tip"=>"tercume")); } } else { echo json_encode(array("tip"=>"hata")); } ?> 

modify yenikayit2.php avoid php fatal error , notices. can either use error_reporting(null); or edit code below

if (isset($musteri_ekle)) { // avoid undefined variable error     $musteri_id = mysqli_insert_id($baglanti);     $_session['musteri_id'] = $musteri_id;     if ($secilen == "dosya") {         echo json_encode(array("tip" => "dosya"));     } else if ($secilen == "tercume") {         echo json_encode(array("tip" => "tercume"));     } } else {     echo json_encode(array("tip" => "hata")); } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -