Ajax属性发布

where do you think I'm making a mistake in the process below? I didn't use Ajax very well I don't know I tried searching but I wasn't successful.

Html

<td><a href="javascript:void(0)" class="btn btn-success btn-sm kontrolet" kullanici="testuser">Kontrol Et</a>
</td>
<td><div id="loading">Kontrol Edilmedi</div></td>

Ajax


$('.kontrolet').click(function () {
    // add loading image to div
    $('#loading').html('<img width="50" src="<?php echo base_url("assets/front/images/yukleniyor.gif"); ?>">');

    // run ajax request
    $.ajax({
        type: "POST",
        dataType: "html",
        kullanici : $(this).attr('kullanici'),
        url: "<?php echo base_url("kullanici-kontrol"); ?>",
        success: function (d) {
            setTimeout(function () {
                $('#loading').html(d);
            }, 2000);
        }
    });
});

Controller

    public function kullanicikontrol()
    {

        echo $_POST['kullanici'];

    }

I would recommend you to check your code. From what I see it's not valid code. The attribute "kullanici" is not valid for HTML. And the Ajax variable name should be "data" instead of "kullanici".

Try instead:

data-kullanici="testuser"

And for your Ajax call use:

data : $(this).data('kullanici'),

Hope this helps.