Note that there are some explanatory texts on larger screens.

plurals
  1. POInternal Error on jQuery Autocomplete ajax call to ASP.NET
    primarykey
    data
    text
    <p>For some reason I am getting an Internal Error (500) when I am attempting to get a List of strings from an ASP.NET method. I have tried many different ways of writing it and an entire page of google is all purple but to no avail. Perhaps maybe you guys can spot something I am completely missing.</p> <p>Here is the HTML/Javascript</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="messaging.aspx.cs" Inherits="xxx.messaging" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="content" runat="server"&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { //$(".selectable").selectable(); $('[id$="username_textbox"]').autocomplete({ source: function (request, response) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "Services.asmx/getFollowingUsernames", dataFilter: function (data) { return data; }, data: "{'prefixText': '" + request.term + "' }", dataType: "json", success: function (data) { response(data.d); }, error: function (xhr, textStatus, errorThrown) { var errorMessage = "Ajax error: " + this.url + " : " + textStatus + " : " + errorThrown + " : " + xhr.statusText + " : " + xhr.status; if (xhr.status != "0" || errorThrown != "abort") { alert(errorMessage); } } }); }, search: function (event, ui) { $('.spinner').show(); }, response: function (event, ui) { $('.spinner').hide(); }, minLength: 1 }); }); &lt;/script&gt; &lt;div class="messaging_wrapper"&gt; &lt;div class="conversations_list" runat="server"&gt; &lt;asp:Button ID="new_message" runat="server" Text="New Message" /&gt; &lt;ol id="conversation_ol" class="selectable" runat="server"&gt; &lt;/ol&gt; &lt;/div&gt; &lt;div id="conversation_wrapper" class="converation_div" runat="server"&gt; &lt;div id="conversation_head"&gt; &lt;asp:TextBox ID="username_textbox" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;img src="images/ajax-loader.gif" style="display:none" class="spinner" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/asp:Content&gt; </code></pre> <p>Here is the WebService code:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace xx.App_Code { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // 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 Services : System.Web.Services.WebService { [WebMethod] public List&lt;string&gt; getFollowingUsernames(string prefixText) { SessionAdapter sa = new SessionAdapter(); int id = sa.getUserID(); MembershipAdapter ma = new MembershipAdapter(); List&lt;int&gt; ids = new List&lt;int&gt;(); ids = ma.getUserFollowingList(id); List&lt;string&gt; usernames = new List&lt;string&gt;(); foreach (int userID in ids) { usernames.Add(ma.getUserName(userID.ToString())); } return usernames; } } } </code></pre> <p>Here is what the internal error is:</p> <p><img src="https://i.stack.imgur.com/q5GTg.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload