0

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.

Edited by castajiz_2: NBIO

2
Contributors
1
Reply
8
Views
3 Years
Discussion Span
Last Post by nikkitata
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.