I have autocomplete implemented. I have implementation of bootstrap Modal
. All i want to do is to add a new option in autocomplete response i.e Add new Item
at the end.
So how to implement this. My code for autocomplete is as:
$(document).ready(function () {
var makesCache = {}, modelsCache = {}, makesXhr, modelsXhr;
$('#<%= txtName.ClientID%>').autocomplete({
source: function (request, response) {
var term = request.term;
if (term in makesCache) {
response(makesCache[term]);
return;
}
if (makesXhr != null) {
makesXhr.abort();
}
makesXhr = $.getJSON('AutoComplete.svc/GetProjects', request, function (data, status, xhr) {
makesCache[term] = data.d;
if (xhr == makesXhr) {
response(data.d);
makesXhr = null;
}
});
}
});
});
The html for the modal which i want to be visible by the option inside autocomplete:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
So how to implement this!!