xxxxxxxxxx
function searchAjax(search) {
if (search.length > 2) {
let returnData = [];
$.ajax({
url: '{{ route('web.product.search-json') }}',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
type: 'GET',
data: {
search: search
},
async: false,
cache: false,
dataType: 'json',
success: function(data) {
returnData = data;
}
});
return returnData;
} else {
return [];
}
}