Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7959139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:31:34+00:00 2026-06-04T04:31:34+00:00

This is driving me crazy , I just keep getting the message error nothing

  • 0

This is driving me crazy , I just keep getting the message “error” nothing else. I had this autocomplete working with AJAX Toolkit, but I want to try JQuery, I have very little experience with JQuery. Here is WebService code:

  [WebService(Namespace = "http://tempuri.org/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
  [System.Web.Script.Services.ScriptService]
 public class WebService : System.Web.Services.WebService {

public WebService () {

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
}

[WebMethod]
public static string GetNames(string prefixText, int count)
{
    Trie ArtistTrie = new Trie();
    if (HttpContext.Current.Cache["CustomersTrie"] == null)
    {          
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString);
        SqlCommand comm = new SqlCommand();
        comm.CommandText = "SELECT * FROM TopArtists ORDER BY name ASC";
        SqlDataAdapter da = new SqlDataAdapter();
        DataTable dt = new DataTable();            
        da.SelectCommand = comm;
        comm.Connection = conn;
        conn.Open();
        da.Fill(dt);
        conn.Close();
        Trie newtrie = new Trie();
        foreach (DataRow dr in dt.Rows)
        {
            // topartists.Add(dr[0].ToString());
            newtrie.Add(dr[0].ToString());
        }
        HttpContext.Current.Cache["CustomersTrie"] = newtrie;
    }
     ArtistTrie = (Trie)HttpContext.Current.Cache["CustomersTrie"];

     List<string> list = ArtistTrie.GetCompletionList(prefixText, 10);
     List<Band> list1 = new List<Band>();
     foreach (string a in list)
     {
         Band newband = new Band();
         newband.Name = a;
         list1.Add(newband);
     }
     string json = JsonConvert.SerializeObject(list1, Formatting.Indented);
     return json;

}

Here is JQuery Code:

    <script type="text/javascript">
      $(document).ready(function () {
        $(function () {
           $("#tb1").autocomplete({

        source: function (request, response) {
            $.ajax({
                url: "WebService.asmx/GetNames",
                data: request.term ,
                dataType: "json",
                type: "POST",
                contentType: "application/json; charset=utf-8",

                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(textStatus);
                }
            });
        },
        minLength: 2
         });
        });
      }) 
    </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:31:35+00:00Added an answer on June 4, 2026 at 4:31 am

    Well for one, your jQuery code has errors, including a missing semicolon at the end and an unnecessary function wrapping the autocomplete, try:

    <script type="text/javascript">
        $(document).ready(function() {
            $("#tb1").autocomplete({
                source: function(request, response) {
                    $.ajax({
                        url: "WebService.asmx/GetNames",
                        data: request.term,
                        dataType: "json",
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            alert(textStatus);
                        }
                    });
                },
                minLength: 2
            });
        }); 
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe it is just a simple mistake but this thing is driving me crazy.
This problem is driving me crazy because I am not sure why this just
This is driving me crazy, I just can't find out the problem: I have
This is driving me crazy. Just testing a site on IE9 and discovered that
This is driving me crazy, as it's very easy on gitk (just gitk the/file
This has been driving me crazy all day. I just want the value of
This is driving me absolutely crazy. I have a package that was working fine,
This is driving me crazy and has resulted in lost work (not much, at
This is driving me crazy, so... When resizing image to small thumbnail, resulting image
This is driving me crazy. I have a very simple user control: public int?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.