Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing remote data to autocomplete
    primarykey
    data
    text
    <pre><code> $(document).ready(function () { $("#example").autocomplete("https://graph.facebook.com/me/friends?access_token=" + accessToken + "&amp;callback=?", { width: 250, height: 400, max: 8, dataType: 'jsonp', cacheLength: 10, minChars: 1, parse: function (data) { var rows = new Array(); data = data.data; for (var i = 0; i &lt; data.length; i++) { rows[i] = { data: data[i], value: data[i].name, result: data[i].name }; } return rows; }, formatItem: function (data, i, n, value, text, a, b, c, d) { var x = getImage(data.id); return "&lt;div class='test2'&gt;&lt;img class='test' width='32px' height='32px' src='" + x + "'&gt;&lt;/img&gt;&lt;span&gt;" + data.name + "&lt;/span&gt;&lt;/div&gt;"; }, } ).result(function (evnet, item) { alert(item.id); }); }); &lt;input type="text" id="example"/&gt; </code></pre> <p>I am using this code for facebook friends autosuggestion.It works,but its too slow because every time autocomplete function searching data from remote location.</p> <p>Is there any other way to pass remote data by saving in a variable and passing it to .autocomplete() function.</p> <p>Later i tried by saving the remote data to a variable , but i can't pass the variable to autocomplete.</p> <p>jQuery(document).ready(function () {</p> <pre><code>var aToken = document.getElementById('aToken').value; jQuery.getJSON("https://graph.facebook.com/me/friends?access_token="+aToken, function(data) { var data = data; }); jQuery("#name_inp").autocomplete({ width: 500, height: 200, max: 5000, source: data, dataType: 'jsonp', cacheLength: 10, minChars: 1, parse: function (data) { var rows = new Array(); data = data.data; for (var i = 0; i &lt; data.length; i++) { rows[i] = { data: data[i], value: data[i].name, result: data[i].name }; } return rows; }, formatItem: function (data, i, n, value, text, a, b, c, d) { var x = getImage(data.id); return "&lt;div class='test2' onclick='return getId("+data.id+");'&gt;&lt;span&gt;" + data.name + "&lt;/span&gt;&lt;/div&gt;"; }, } ) }); </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.
    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