<script type="text/javascript">
$("#textbox").autocomplete({
source: function
(request, response) {
$.ajax({
url: "search.php",
dataType: "json",
data: request,
success: function (data) {
var
regex = new RegExp("(?![^&;]+;)(?!<[^<>]*)("
+ request.term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)",
"gi");
var
result = $.map(data, function (value) {
return value.replace(regex, "<b>$1</b>");
});
response(result);
}
});
}
});
</script>
No comments:
Post a Comment