none
JQuery Autocomplete textbox with web servise and database RRS feed

  • Question

  • Getting Error : "Microsoft JScript runtime error: 'length' is null or not an object" in jquery-1.4.min.js page.

    I am using this code to call web service :

    <script type="text/javascript">
            $(document).ready(function() {
                $("#<%=txtSearch.ClientID %>").autocomplete({
                    source: function(request, response) {
                        $.ajax({
                            url: '<%=ResolveUrl("~/Service.asmx/GetStn") %>',
                            data: "{ 'prefix': '" + request.term + "'}",
                            dataType: "json",
                            type: "POST",
                            contentType: "application/json; charset=utf-8",
                            success: function(data) {
                                response($.map(data.d, function(item) {
                                    return {
                                        label: item.split('-')[0],
                                        val: item.split('-')[1]
                                    }
                                }))
                            },
                            error: function(response) {
                                alert(response.responseText);
                            },
                            failure: function(response) {
                                alert(response.responseText);
                            }
                        });
                    },
                    select: function(e, i) {
                        $("#<%=hfCustomerId.ClientID %>").val(i.item.val);
                    },
                    minLength: 1                
                });
    
            }); 
        </script>





    Thursday, December 5, 2013 11:06 AM

Answers

All replies