Issues With Automplete jquery while Editing the SearchField

37 Views Asked by At

I am doing ontext change search by the help of autocomplete in jQuery using AJAX To search for trainees by their name. Everything is working fine, but when I am editing (making the search field empty) I am getting an empty list instead of the total list. How canI fix this?

<input class="form-control" id="SearchString" value="" name="SearchString" type="text" placeholder="Search Trainee.." />
$("#SearchString").autocomplete({
    source: function (request, response) {
        $.ajax({
            url: "/Admin/Trainee/TraineeList",
            data: { 
                currentFilter: document.getElementById("selectThis").value,         
                searchString: request.term 
            },
            success: function (result) {
                $('#maindiv').html(result);
                $("#SearchString").val(request.term);
                $("#SearchString").focus();
            },
            error: function () { 
                alert("Some thing went wrong"); 
            }
        });
    }
});
0

There are 0 best solutions below