• 24-08-2020, 11:09:22
    #1
    Üyeliği durduruldu
    Merhaba arkadaşlar ajax ile anlık veri çekmeye çalışıyorum ama kontrol ettiğimde tanımsız veri hatası alıyorum bunun sebebi nedir ?


    Ajax Kodum
        function kullanicilar()
            {
              var kullanicim = $("#kullaniciguncelle").serialize();
    
              $.ajax({
    
              type :"POST",
              data : "kullanicim",
              url  : "inc/inc.php",
              success : function(kullaniciverisi)
              {
                if($.trim(kullaniciverisi)=="bos")
                {
                  sweatAlert("hata","Lütfen Boş Alanları Doldurunuz..","error");
                }else if($.trim(kullaniciverisi)=="ok")
                {
                  sweatAlert("basarili","Başarıyla Güncellendi","success");
                }
              }
    
    
              });
    
            }
    Aldığım veri
      <form action="" method="POST" id="kullaniciguncelle" onsubmit="return false;">
                    <div class="card-body">
                      <div  class="form-group">
                        <label for="exampleInputEmail1">Kullanıcı Adı</label>
                        <input type="text" name="kullanici_adi" class="form-control" value="<?= getid('kullanici_adi');?>">
                      </div>
                      <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Mail</label>
                        <input type="text" name="kullanici_mail" class="form-control" id="" value="<?= getid('kullanici_mail');?>">
                      </div>  
                      <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Şifre</label>
                        <input type="password" name="kullanici_sifre" class="form-control" id="" value="<?= getid('kullanici_sifre');?>">
                      </div>
                      <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Cinsiyet</label>
                        <input type="text" name="kullanici_cinsiyet" class="form-control" id="" value="<?= getid('kullanici_mail');?>">
                      </div>
                      <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Yaş</label>
                        <input type="text" name="kullanici_yas" class="form-control" id="" value="<?= getid('kullanici_yas');?>">
                      </div>
                      <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Meslek</label>
                        <input type="text" name="kullanici_meslek" class="form-control" id="" value="<?= getid('kullanici_meslek');?>">
                      </div>
                      <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Şehir</label>
                        <input type="text" name="kullanici_sehir" class="form-control" id="" value="<?= getid('kullanici_sehir');?>">
                      </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Unvan</label>
                        <input type="text" name="kullanici_unvan" class="form-control" id="" value="<?= getid('kullanici_unvan');?>">
                      </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Kullanıcı Durum</label>
                        <input type="text" name="kullanici_durum" class="form-control" id="" value="<?= getid('kullanici_durum');?>">
                      </div>
                  
                    <input type="hidden" name="kullanici_id" id="kullanici_id" value="<?=getid('kullanici_id');?>">
                    <div class="card-footer">
        
                      <button   class="btn btn-primary"  onclick="kullanicilar();">Güncelle</button>
                    </div>
                  </form>
                </div>
    Tanımsız Veri hatası aldığım yer inc.php

    if($_POST)
    {
    
    echo $_POST['kullanici_adi'];
    
    }
  • 24-08-2020, 11:14:29
    #2
    data parametresinde çift tırnak açmışsınız


    data: kullanicim,



    Olacak
  • 24-08-2020, 11:17:38
    #3
    Üyeliği durduruldu
    GianC adlı üyeden alıntı: mesajı görüntüle
    data parametresinde çift tırnak açmışsınız


    data: kullanicim,



    Olacak
    of ben onu nasıl görmedim sanırım uyku sersemliği gözümden kaçmış yani yuh diyorum kendime sorun olmamasına rağmen neden çalışmaz diye kafayı yedim teşekkür ederim hocam