Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Autocomplete with C# and SQL Server Database
    primarykey
    data
    text
    <p>I am trying to use jQuery autocomplete on my dynamically created textboxes. this is my first time working with jQuery so I am not so sure about where I am getting off... My ASMX page code is working fine &amp; generating result as asked but my javascript of autocomplete is not calling the page at all (tried in debug) and its not giving me error message either... Help Please!!</p> <p>EDIT : I am still having error "ASP.NET Ajax client-side framework failed to load."</p> <pre><code>&lt;script src="/ScriptResource.axd?d=dRAn80ZulnXIbHUFZAi0thqEaFFdeMlwAh6uA_ciIINTs7jTUe13ADvaDyjOl6tPSr-1TN4Bqt6MFVjznyiXABGNxDhFk5_-02EGxOku0B-Tim4ebG59zhvC6DdsHV11uoIY024U1o0IMngrTBO45x9tPeG-PiyEUPEypUFf795T-3SY0&amp;amp;t=ffffffffb868b5f4" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; &lt;!-- if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.'); </code></pre> <p>Upon typing in the textbox, I get the pop up error : </p> <p>Ajax error: researcher_list.asmx/FetchResList : error : undefined : Internal Server Error : 500</p> <p><strong>EDITED CODE :</strong></p> <p>Aspx Code : </p> <pre><code>$(function() { $('input:text').autocomplete({ source: function(request, response) { var pString = '{ "resName": "' + request.term + '" }'; $.ajax({ url: "researcher_list.asmx/FetchResList", /* same root as the page? */ data: pString, dataType: "jsond", type: "POST", contentType: "application/json", /* simplify */ converters: {/* avoid the d or no d issue, works with 3.5 or prior this way */ "json jsond": function(msg) { return msg.hasOwnProperty('d') ? msg.d : msg; } }, success: function(data) {/* assumes data always returned and it IS called item in the JSON */ response($.map(data, function(item) { return { value: item.name, label: item.name } })) }, 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); } } }); }, minLength: 2 }); }); </code></pre> <p>Asmx Code : </p> <pre><code>[WebService(Namespace = "http://localhost/v2/pages/main.aspx")] [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 researcher_list : System.Web.Services.WebService { [WebMethod] public List&lt;DBResearcher.Summary&gt; FetchResList(string resName) { //SqlConnection connection; //SqlCommand command = null; //SqlDataReader myReader = null; //string sql; //StringBuilder sb = new StringBuilder(); var tempSum = new DBResearcher(); var allRes = DBResearcher.GetAllResearcher() .Where(m =&gt; m.name.ToLower().Contains(resName.ToLower())); return allRes.ToList(); } public static string[] GetCustomerNames() { string[] data = new string[] { "Andrew", "Ramona", "Russ", "Russell", Raymond" }; return data; } } </code></pre> <p>web.config file :</p> <pre><code>&lt;httpHandlers&gt; &lt;!-- AJAX.Net Configuration --&gt; &lt;add verb="GET,POST" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/&gt; &lt;remove verb="*" path="*.asmx"/&gt; &lt;add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt; &lt;add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt; &lt;add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt; &lt;/httpHandlers&gt; &lt;!-- HTTP MODULES --&gt; &lt;httpModules&gt; &lt;!-- doesn't work if we restrict it by &lt;location path=...&gt; for some reason, so we have no choice but to do this at the root level. --&gt; &lt;!--&lt;add name="HttpUploadModule" type="AssistedSolutions.SlickUpload.HttpUploadModule, AssistedSolutions.SlickUpload" /&gt; --&gt; &lt;add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt; &lt;/httpModules&gt; </code></pre> <p>EDIT - Error while running asmx page on its own</p> <pre><code>Stack Trace: [HttpException (0x80004005): Failed to Execute URL.] System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.BeginExecuteUrl(String url, String method, String childHeaders, Boolean sendHeaders, Boolean addUserIndo, IntPtr token, String name, String authType, Byte[] entity, AsyncCallback cb, Object state) +2008569 System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state) +393 System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +220 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8699714 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155 </code></pre>
    singulars
    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.
 

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