Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to build a simple test case that uses jQuery UI v10 Autocomplete to get data from a webservice, but I get this when I try to make the ajax call to the web service:

System.ArgumentException: Item has already been added. Key in dictionary: 'SetAccountProperty' Key being added: 'SetAccountProperty'

This code is adapted from [http://jqueryui.com/autocomplete/#remote-jsonp] and the only significant difference I can see is that I use a POST instead of a GET, and that is because C# .NET web services need a POST.

        <fieldset>
            <legend>City Lookup:</legend>
            <div class="cityLookup">
                <label for="city1">City1:</label>
                <input id="city1" />
                <label for="city2">City2:</label>
                <input id="city2" />
            </div>
            <div>
                <span id="remoteResult"></span>
            </div>
        </fieldset>


$(function () {
    $("#city1").autocomplete({
        source: function (request, response) {
            $.ajax({
                url: "WebServices/FLSAService.asmx/CityList",
                type: "POST",
                dataType: "json",
                data: {
                    prefixText: request.term,
                    count: 20
                },
                success: function (data) {
                    response($.map(data.geonames, function (item) {
                        return {
                            label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
                            value: item.name
                        }
                    }));
                }
            });
        },
        minLength: 2,
        select: function (event, ui) {
            reportRemoveResult(ui.item ?
                "Selected: " + ui.item.label :
                "Nothing selected, input was " + this.value);
        },
        open: function () {
            $(this).removeClass("ui-corner-all").addClass("ui-corner-top");
        },
        close: function () {
            $(this).removeClass("ui-corner-top").addClass("ui-corner-all");
        }
    });
});
share|improve this question
2  
That's a .Net exception from your server. What's the stack trace? Show us the C# code. – SLaks Jun 17 at 21:19

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.