I’m an amateur programmer so go easy on me. I am trying to call getJson only once to pull an array, then have jquery autocomplete use that as a source. It seems like this code is never calling the handler.
<script>
$(function () {
var availableTags[];
$.getJSON("./Handler.ashx", function(data) {
availableTags = data;
});
$("#TextBox3").autocomplete({
source: availableTags
});
});
</script>
the code below works but I do not want js to call the handler every time .
<script>
$(function () {
$("#TextBox3").autocomplete({
source: "./Handler.ashx",
minLength: 3,
select: function (event, ui) {
$(this).val(ui.item.value);
}
});
});
</script>
Try something like this: