Auto complete ERROR 404 in HTML (using ASP.NET and JQuery)

For some reason in project, my autocomplete won’t work, I have tried different methods from using Data source in data connection but to no avail. I have already created a database for it called Diagnose but for some reason, it displays error 404 on jquery.

Here is my HTML code:

<script src=""></script>
<script src=""></script>
    $(function () {
            source: function (request, response) {
                var param = {
                    searchdetails: $('#search-diagnosis').val()
                    url: "SearchController.cs/GetSearch",
                    data: JSON.stringify(param),
                    type: "post",
                    contentType: "application/json; charset=utf-8",
                    dataFilter: function (data) { return data; },
                    success: function (data) {
                        response($.map(data.d, function (item) { return { value: item } }))
            minLength: 1

<div class="search">
    <input id="search-diagnosis" class="w-75" type="text" placeholder="Start typing your diagnois...">

Here is CS code:

public static List<string> GetSearch(string searchdetails)
    List<string> search = new List<string>();
    string mainconn = ConfigurationManager.ConnectionStrings["mybase.database"].ConnectionString;
    SqlConnection sqlconn = new SqlConnection(mainconn);
    string sqlquery = string.Format("select Name from [dbo].[Diagnose] where Name LIKE '%{0}%'", searchdetails);
    SqlCommand sqlcomm = new SqlCommand(sqlquery, sqlconn);
    SqlDataReader sdr = sqlcomm.ExecuteReader();
    while (sdr.Read())
    return search; 

It displays error:

This error
When I open the jquery-1.8.0.js:8214 it shows me this xhr.send( ( s.hasContent && ) || null );

I’m stuck at this problem for a while so any help would be great, thanks in advance 😀 <3

Stack Overflow Asked on December 31, 2020

1 Answers

One Answer

It is returning 404 not found. I think that GetSearch should be inside of an aspx or an ascx file. Webmethod works in System.Web context and in some point it will require Page.

Answered by Kev on December 31, 2020

Add your own answers!

Related Questions

Keycloak permission to restrict account based resources

0  Asked on December 26, 2020 by james-lin


CSS flex, full height sidebar inside a modal?

1  Asked on December 25, 2020 by ddulla


Cant loop through List and display in DataTable

1  Asked on December 25, 2020 by finchy70


Automate and looping through batch script

2  Asked on December 25, 2020 by nck_505


issue connecting Heroku PHP stack to Redis using Predis

0  Asked on December 25, 2020 by rob-edlin


Splitting C linked list without making a copy

2  Asked on December 24, 2020


Notice Messages Do Not Appear On The Page

1  Asked on December 24, 2020 by cifhai


Making comparisons in a HTTPS GET request in node js

0  Asked on December 24, 2020 by thor_


SwiftUI Horizontal ScrollView does not scroll

1  Asked on December 23, 2020 by hillinharwich


Calling a tab fragment method inside the parent acitivity

0  Asked on December 23, 2020 by aaron-waller


Hiding table rows works, but fading out does not

1  Asked on December 23, 2020 by diamondjoe12


How to list kubernetes services in k9s?

1  Asked on December 23, 2020 by matthias-m


Ask a Question

Get help from others!

© 2022 All rights reserved.