Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Need help with Ajax call

$
0
0

Hi there,

In an .net MVC application I have a following Ajax call that gets the names from database.

$("#searchString").focusin(function () {$("#searchString").autocomplete({
                    source: function (request, response) {$.ajax({
                            url: "/Home/GetNames",
                            type: "POST",
                            dataType: "json",
                            data: { Prefix: request.term },
                            success: function (data) {
                                alert("data: " + data);
                                response($.map(data, function (item) {
                                    return { label: item.term, value:item.term };
                                }))
                            }
                        })
                    }
                });
            });

The line alert(data) shows me a list of strings separated by commas that was returned from a method GetNames. I don't understand these lines and these are not working. How do I display this list of strings as this autocomplete?

Joe


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>