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 8332021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:35:52+00:00 2026-06-09T02:35:52+00:00

I am working on a project that requires to autocomplete textbox when some data

  • 0

I am working on a project that requires to autocomplete textbox when some data is inputted and the data will be fetched from a database.

For this I created a webservice as –

    [WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[ScriptService]
public class SearchIssues : System.Web.Services.WebService
{
    //[ScriptMethod]      
    [WebMethod]
    public string[] GetCompletionList(string prefixText)
    {
        DataSet ds = null;
        DataTable dt = null;
        OracleConnection conn = null;
        StringBuilder sb = new StringBuilder();
        try
        {
            conn = new OracleConnection(WebConfigurationManager.ConnectionStrings["Conn"].ToString());
            sb.Append("select issueno from cet_sepcet where issueno like '");
            sb.Append(prefixText);
            sb.Append("%'");
            OracleDataAdapter daRes = new OracleDataAdapter(sb.ToString(), conn);
            ds = new DataSet();
            daRes.Fill(ds);
            dt = ds.Tables[0];
        }         
        catch (Exception exc)
        {

        }

        if (conn.State == ConnectionState.Open)
        {
            conn.Close();
        }
        List<string> IssueList = new List<string>();
        for (int i = 0; i < dt.DataSet.Tables[0].Rows.Count; i++)
        {
            IssueList.Add(dt.DataSet.Tables[0].Rows[i][0].ToString());
        }
        return IssueList.ToArray();
    }
}

The jquery ajax method I wrote is as –

         $(function() {
        $(".tb").autocomplete({
            source: function(request, response) {               
            debugger;
                $.ajax({
                    url: "SearchIssues.asmx/GetCompletionList",
                    data: request.term,
                    dataType: "json",
                    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                           
                            }
                        }))
                        //alert('Hello');
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                     debugger;
                        alert(errorThrown);
                    }
                });
            },
            minLength: 1
        });
    });

The webservice is running perfectly fine. But the problem comes when I try to call the webservice from the .aspx page. Its throws Internal server error.

I am not sure as where I am going wrong. Kindly help.

Thanks in advance.
Akhil

  • 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-09T02:35:53+00:00Added an answer on June 9, 2026 at 2:35 am

    I advice you to use firebug to check whether your Post requests and responses this way you can easily debug your application.

    This one in your code of ajax

      data: request.term,
    

    Should be actually

      data:  "{'prefixText':'" + request.term+ "'}",
    

    Your service is expecting prefixText string as a parmeter, I assume request.term is the value.

    Update :

    I dont know what is not working at your end this works for me :

            <script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
            <script src="js/jquery-ui-1.8.custom.min.js" type="text/javascript"></script>
            <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    
            <script type="text/javascript">
                $(document).ready(function() {          
                   $("input#autocomplete").autocomplete({
                    source: function (request, response) {
                        $.ajax({
                            url: "/Service/WSDataService.asmx/GetStatesWithAbbr",
                            data: "{'name':'" + $(autocomplete).val() + "'}",
                            dataType: "json",
                            type: "POST",
                            contentType: "application/json; charset=utf-8",
                            dataFilter: function (data) { return data; },
                            success: function (data) {
                                response($.map(data.d, function (item) {
                                    return {
                                        label: item.Name,
                                        value: item.Name
                                    }
                                }))
                            }
                        });
                    },
                    minLength: 1
                  });
                });
            </script>
    

    ….

         <input id="autocomplete" />
    

    Service :

       [WebMethod]        
        public List<State> GetStatesWithAbbr(string name)
        {
            List<State> sbStates = new List<State>();
            //Add states to the List
           }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project that requires me to load some of the data
I am working on a project that requires some image processing. The front end
Currently am working on a project that requires me to create some XML for
I'm working on a project that requires me to programmatically create MySQL users from
I am working on a project that requires that I render XML data (that
I am working on a project that requires me to display some live video
I am working on a project that requires a number of icons generated from
I am working on a project that requires some HTML sanitization. Normally, I would
I am working on a project that requires me to underline some text in
I am working on a project that requires JDBC Calls to an Oracle Database.

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.