Autocomplete Jquery remote data not auto filter like local array

Liegeflek

New Member
I am starting with simple autocomplete from Jquery in two cases: local array and remote source data from other page. I am sure the data for both be the same but Autocomplete work differently. Refer my code below:1. With local arrayJavascript code\[code\]$(document).ready(function() { $("#txtArr").autocomplete({ source: programmingLang, change:function(event, ui){ if (ui.item==null) $('#txtArr').val(-1); } })})\[/code\]programmingLang array: \[code\]var programmingLang = [{ "value": "ActionScript", "id": 31 }, { "value": "AppleScript", "id": 2 }, { "value": "JavaScript", "id": 3 }, { "value": "Haskell", "id": 33 }, { "value": "Architects", "id": 27 }, { "value": "Scheme", "id": 1 }, { "value": "PHP", "id": 29 }, { "value": "Marketing", "id": 25 }, { "value": "Perl", "id": 15 }, { "value": "Training", "id": 32}];\[/code\]From browser, I typed p, ..., items which contain 'p' dispayed in list - perfect:) 2. Remote by source dataJavascript code\[code\]<script type="text/javascript"> $(document).ready(function() { $("#txtArr").autocomplete({ source: "script.asp", change:function(event, ui){ if (ui.item==null) $('#txtArr').val(-1); } })})\[/code\]script.asp\[code\]<% Response.ContentType = "application/json; charset=utf-8" Response.Write("[{ ""value"": ""ActionScript"", ""id"": 31 }, { ""value"": ""AppleScript"", ""id"": 2 }, { ""value"": ""JavaScript"", ""id"": 3 }, { ""value"": ""Haskell"", ""id"": 33 }, { ""value"": ""Architects"", ""id"": 27 }, { ""value"": ""Scheme"", ""id"": 1 }, { ""value"": ""PHP"", ""id"": 29 }, { ""value"": ""Marketing"", ""id"": 25 }, { ""value"": ""Perl"", ""id"": 15 }, { ""value"": ""Training"", ""id"": 32}]")%>\[/code\]From browser: type p ... all items in array be listed :(How can I fix for both of them work the same as local array?Many thanks.
 
Back
Top