Skip to main content

City of South Burlington, Fire Dept., Rental Registry

Citation
City of South Burlington, Fire Dept., Rental Registry
Source
Official source

Full Text

1,727 chars
cancelPendingAutoComplete();
autoCompleteDebounceKey = cacheKey;
pendingAutoCompleteResponses.push(response);
autoCompleteDebounceTimer = setTimeout(function () {
autoCompleteDebounceKey = null;
currentAutoCompleteRequestKey = cacheKey;
currentAutoCompleteRequest = $.ajax({
url: requestUrl,
dataType: "json",
timeout: options.timeout,
data: {
term: term,
},
success: function (data) {
if (currentAutoCompleteRequestKey === cacheKey) {
cacheAutoCompleteResult(cacheKey, data);
respondToPendingAutoComplete(data);
if (options.success) {
options.success(data);
}
}
},
error: function (xmlhttprequest, textstatus, message) {
if (textstatus === "abort") {
return;
}

if (options.error) {
options.error(xmlhttprequest, textstatus, message);
}

respondToPendingAutoComplete([]);
},
complete: function (xmlhttprequest) {
if (currentAutoCompleteRequest === xmlhttprequest) {
currentAutoCompleteRequest = null;
currentAutoCompleteRequestKey = null;
}
}
});
}, options.delay);
};
}

// click handler for search buttons
$(buttonSelector).click(function (e) {
e.preventDefault();
var $btn = $(this);
var $field = $btn.siblings(".widgetSearchBox");
var term = $field.val() + "";
if (!shouldSearch(term)) {
// do nothing until user types enough characters
$field.focus();
return;
}

if ($(checkboxSelector).is(':checked') || false)
{
doWidgetSearch($.trim(term), Number(0));
}
else {
doWidgetSearch($.trim(term), 0);
}
});

// enter key handler for the search field
$(searchFieldSelector).keypress(function (e) {
var code = e.which || e.keyCode;
if (code === 13) {
e.preventDefault();
var $this = $(this);
var term = $this.val() + "";
if (!shouldSearch(term)) {
// do nothing until user types enough characters
$this.focus();
return false;
}