I'm currently having an issue while trying to pass Data to my controller in my MVC application.

Here is my code

  $('#idNumber')
            .autocomplete(
            {


                source: "/@Resources.Global.Lang/Client/AutoComplete?ID=" + $("#idNumber").val() + "&country=" + $("#country").val(),

                select: function (e, ui) {
                    var temp = $("#idNumber").val();
                    var temp2 = $("#country").val();
                    $.ajax({
                        type: 'POST',
                        url: "/@Resources.Global.Lang/Client/searchClientByID?ID=" + temp + "&country=" + temp2,
                        dataType: 'json',
                        success: function (data) {

                            $("#Client_CountryCode").val(data["CountryCode"]);
                            $("#country").val(data["Country"]);
                        }
                    });

                },
            });

This is my DropDownlist

        @Html.DropDownList("country", ((ClientController)ViewContext.Controller).GetCountries(), "United Kingdom", new { @class = "dropDownCountry",@id = "country" })

My method in ClientController always receive the default value I set for that dropdownlist, in this case United Kingdom and even if I change it to another value.
Can someone help me out? I have no idea why my Dropdownlist selected value doesn't work whenever I call the autocomplete function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.