Click here to Skip to main content
15,937,602 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more: , +
I work on MVC web API . I face issue when call web API using jQuery ajax request

my issue is autocomplete result display separated by slash

Id - Name - Designation

but expected result I need to get is :

Id : 121

Name : michel nicol

Designation : It Manager

Meaning I need to display Id on First line and second line I will display Name and Third Line I will display Designation .

so every property will be on one line instead of using slash separated .

What I have tried:

        source: function (request, response) {
            var searchTextDirectManager = $("#txtDirectManagerId").val();
            console.log("search text" + searchTextDirectManager)
                url: '@Url.Action("GetAllEmployeeBasedSearchTextDirectManager", "Resignation")',
                data: { searchTextDirectManager: searchTextDirectManager },
                method: "GET",
                dataType: "json",
                success: function (data) {
                    response($.map(data, function (item) {
                            label: "File No : " + item.EmployeeID + " - " + "Name :" + item.EmployeeName + " - " +
                                "Designation : " + item.Designation, value: item.EmployeeID, employeeName: item.EmployeeName

        position: { my: "right top", at: "right bottom" },
        appendTo: '#searchContainerDirector',
        select: function (event, ui) {
        minLength: 4,
html controls used on autocomplete

 <div class="col-md-7">
                    @Html.EditorFor(model => model.LineManager, new { htmlAttributes = new { @class = "form-control", id = "txtLineManagerId" } })
                    <div id="searchContainer">

 <div class="col-md-7">

scripts version used to generate auto complete

<script src=""></script>
<link rel="stylesheet" href="" />
<script src="" type="text/javascript"

<script src="" type="text/javascript"></script>
<script src=""></script>
Graeme_Grant 22-Sep-23 20:19pm    
And what is the problem?
ahmed_sa 22-Sep-23 20:34pm    
problem id and name and designation i need to display it on separated line as expected above
Graeme_Grant 22-Sep-23 21:14pm    
Again, where is the problem?

We're not here to do your programming for you. If you want someone to write code for you, then there are these services:
* fiverr[^]
* Upwork[^]
* Freelancer[^]
* Guru[^]
* PeoplePerHour[^]
* TaskRabbit[^]
* Karat[^]
Member 15627495 23-Sep-23 5:27am    
to add a new line , you have :
html : 1 , or 2 br tag
JS/Jquery : "/n" as string part.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900