I ve been trying for the last 3 hours to get my autocompletetextbox working and tryed all sort of code. My Web service is working from wich I m actually fetching all the stuff but the jquery seems not to work, I m always getting the error when typing the first letter inside the textbox:

Here is the code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Fpz_simulation.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>None</title>
    <link rel="stylesheet" type="text/css" 
href="http://ajax.googleapis.com/ajax/libs/jqueryui
        /1.8/themes/base/jquery-ui.css" />

<script   type="text/javascript" src=
  "http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js">
    </script>  

<script  type="text/javascript" src=
  "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js">
    </script> 
    <script type="text/javascript" >
        $(function () {
            $('#<%= txtStudentName.ClientID %>').autocomplete({
                source: function (request, response) {
                    $.ajax({
                        url: "WebService1.asmx/GetNastavnik",
                        data: "{ 'searchTerm': '" + request.term + "' }",
                        type: "POST",
                        dataType: "json",
                        contentType: "application/json;charset=utf-8",
                        success: function (data) {
                            response(data.d);
                        },
                        error: function (result) {
                            alert('There is a problem processing your request');
                        }
                    });
                },
                minLength: 0
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:TextBox ID="txtStudentName" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    </div>
    </form>
</body>
</html>

I have also downloaded the jquery code and made a refference to it but that didn't work so I chose to get the code with the URL's above.

Nice one dude... Code is absolutely correct..

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.