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


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


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