Problem in JsonResult

Posted by Saravanan I M on Stack Overflow See other posts from Stack Overflow or by Saravanan I M
Published on 2010-05-26T03:05:01Z Indexed on 2010/05/26 3:21 UTC
Read the original article Hit count: 341

Filed under:
|
|

I am using the jsonresult for listing all the cities under a country. I retrieve the data from database and load it to a dropdown list using jquery. The problem is if the cities goes beyond 3000 then the jsonresult is not working.

<script type="text/javascript">
  $(document).ready(function () {
    //Hook onto the MakeID list's onchange event       
    $("#Country").change(function () {
        //build the request url
        $("#HomeTown").empty();

        var url = '<%= Url.Content("~/") %>' + "Location/GetCitiesByCountry/" + $("#Country").val();

        $.getJSON(url, function (data) {

            $.each(data, function (index, optionData) {

                $("#HomeTown").append("<option value='" + optionData.geonameid + "'>" + optionData.asciiname + "</option>");

            });
            $("#HomeTown").option[0].selected = true;
        });
    }).change();
  });
</script>

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery