<script type="text/javascript">
$(document).ready(function () {
$('.QuickSearch').each(function (index, value) {
var QuickSearchURL = $(this).attr('qsURL');
var QuickSearchWidth = $(this).attr('qsWidth');
$(this).css('width', QuickSearchWidth);
$(this).autocomplete({
source: function (request, response) {
$.ajax({
url: QuickSearchURL,
data: "{ 'filterby': '" + request.term + "','CONID':'" + getQuerystring('CONID') + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) { response($.map(data.d, function (item) { return { label: item.label, value: item.value} })) },
error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); }
});
},
minLength: 1,
autoFocus: true,
delay: 0,
appendTo: 'form',
select: function (event, ui) {
var submitpostaback = $(this).attr('qsPostBack');
var postbacktype = $(this).attr('qsType');
var selectedValue = ui.item.value;
$(this).val(selectedValue);
if (submitpostaback == 'true') {
if (ui.item) {
__doPostBack('SEARCHCOMPLETE', selectedValue + '|' + postbacktype);
}
}
}
});
});
});
function getQuerystring(key, default_) {
if (default_ == null) default_ = "";
key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
var qs = regex.exec(window.location.href);
if (qs == null)
return default_;
else
return qs[1];
}
</script>
How to reproduce the problem: