• 02-11-2020, 20:21:11
    #1
    vs.tc sitesi adı altında bir tane link kısaltma sistemi kurdum ama kutuya linki yazıp enter a basınca işlem görmüyor.Bunu nasıl düzeltebilirim acaba Kod içeriği şu şekilde:

    let $link;
    function GetLink() {
        $.ajax({
            url: '/go/linkcreate',
            type: 'POST',
            dataType: 'json',
            data: {
                _token: document.getElementsByName('csrf-token')[0].getAttribute('content'),
                link: document.getElementById('link').value,
    
            },
            success: function (result) {
                if(result.status) {
                    $('#short-link').attr('href', result.link);
                    document.getElementById('link').value = "";
                    document.getElementById("show-link").style.display = "block";
                    $('#short-link-title').html(result.link);
                    $link = result.link;
                }
    
            },
            error: function (error) {
                alert(error)
            }
        });
    }
    
    var input = document.getElementById("link");
    input.addEventListener("keyup", function(event) {
     
      if (event.keyCode === 13) {
        event.preventDefault();
        GetLink();
      }
    });
    
    
    $(document).ready(function () {
        $("#link").change(function() {
            if (!/^http:\/\//.test(this.value)) {
                this.value = "https://" + this.value;
            }
        });
    });
  • 02-11-2020, 20:22:25
    #2
    SCriptin sahibi şunları yazmıştı ama olmamıştı

    Enter problemi için:

    var input = document.getElementById("link");
    input.addEventListener("keyup", function(event) {

    if (event.keyCode === 13) {
    event.preventDefault();
    GetLink();
    }
    });

    Link düzeltmesi için:

    $(document).ready(function () {
    $("#link").change(function() {
    if (!/^http:///.test(this.value)) {
    this.value = "https://" + this.value;
    }
    });
    });