Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Search Auto Complete not call on first ajax load
    primarykey
    data
    text
    <p>I want to put autocomplete on my site when user input atleat three characters in input box. I m using autocomplete.js plugin for this. What i m doing is on keyup, ajax call send to a url which return all the search results in a form of an array. Then we call our autoComplete.Set("mygroup1", srvcsCitiesSafe, "newPopupStyle"); $("#CAT_Custom_283923").trigger('keyup'); </p> <p>The Problem is that it does not show results on first keyup ajax call. but at second ajax call and son it work fine. Can anybody tell me what is happening... here is the url of my site <a href="http://dbtrialsite.businesscatalyst.com/" rel="nofollow">http://dbtrialsite.businesscatalyst.com/</a> and the auto complete textbox field is Suburb / City: </p> <p>Following is my code</p> <pre><code>$(document).ready(function() { $("#CAT_Custom_283923").keyup(function() { var mystring = $('#CAT_Custom_283923').val(); if (mystring.length == 2) { console.log(mystring); console.log(mystring.length); console.log("Lenght is greater than 2"); var srvcsCitiesSafe=[]; var srvcsPCSafe=[]; var dataString = 'CAT_Custom_283923='+ $('#CAT_Custom_283923').val()+ '&amp;CAT_Custom_284431='+$('#CAT_Custom_284431').val() ; $.ajax({ type: "POST", url: 'http://dbtrialsite.businesscatalyst.com/Default.aspx?CCID=17248&amp;FID=100351&amp;ExcludeBoolFalse=True&amp;PageID=9350053', data: dataString, beforeSend: function () { //put loader here, or hide something console.log('Loading...'); }, success: function (response) { console.log('Ok Results Loaded'); var srvcs_json = []; mydata=$(response); $(".srvcs", mydata).each(function() { var myString=$(this).html(); srvcs_json.push( jQuery.parseJSON( myString ) ); }); var srvcsCities =[]; var srvcsPC =[]; for (var i=0; i &lt; srvcs_json.length; i++) { srvcsCities[i] = srvcs_json[i]['city']; srvcsPC[i] = srvcs_json[i]['postcode']; } srvcsCitiesSafe = eliminateDuplicates(srvcsCities); srvcsPCSafe = eliminateDuplicates(srvcsPC); }, complete: function () { //calling autofill function console.log("auto called"); autoComplete.Set("mygroup1", srvcsCitiesSafe, "newPopupStyle"); $("#CAT_Custom_283923").trigger('keyup'); } }); //end ajax call } }); //////////////////////////////////////////////////////////////////////////////////// }); </code></pre>
    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.
 

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