laravel - datatables implement ajax on enter key pressed

As Im using datatables and have one cluomn countains input text, so I want to get some data on this input field using ajax and only on Enter key pressed, I tried many sloutions but not working with me, if I used on blur or focusout working fine but need this to be only on enter

datatable:

  {data: 'vendor_name', name: 'vendors.vendor_name',mRender: function (data, type, row) {                   
return '<input type="text" id="vendor_name" 
   class="vendor_name" data-id="'+row.id+'" onkeydown="myFunction(event)" 
     onClick="this.select();"  value="'+data+'">';}},

javascript

 <script type="text/javascript">
  function myFunction(event) {
 var x = event.keyCode;
var id = $(this).data("id");
 var $row = $(this).closest('tr');
   if (x == 13) 
 { 
    $.ajax({
        type: 'POST',
        url: 'Vendor_Save',
        data: {
            '_token': $('input[name=_token]').val(),
            'currentid': id,
           'current_vendor_name':$(this).val(),
        },
        success: function(data) {
       $row.closest('tr').find('.category_name').val(data.categoryname); 
     $row.closest('tr').find('.vendor_no').val(data.vendorid);                        
        }
     });
     }
        };
    </script>