Adding code to remove keywords
This commit is contained in:
parent
16da52d53f
commit
305e6d96ec
@ -93,7 +93,24 @@
|
||||
}
|
||||
|
||||
function onForget() {
|
||||
var keyword = $('#searchKeyword').val();
|
||||
if (!confirm('Are you sure you want to delete keyword "' + keyword + '"?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var query = {
|
||||
keyword: keyword
|
||||
};
|
||||
|
||||
$.getJSON('/remove_keyword', query, function(results) {
|
||||
if (results.success) {
|
||||
$('#searchKeyword option:selected').remove();
|
||||
onSearch();
|
||||
}
|
||||
else {
|
||||
alert('Failed to forget keyword');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
@ -156,7 +173,7 @@
|
||||
history.slider('setValue', count - 1);
|
||||
|
||||
if (count > 1) {
|
||||
$('#history').slideDown();
|
||||
$('#history').show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,12 @@ function main(staticFiles, port) {
|
||||
});
|
||||
});
|
||||
|
||||
app.use('/remove_keyword', function(req, res) {
|
||||
search.removeKeyword(req.query, function(results) {
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.use('/search', function(req, res) {
|
||||
search.execQuery(req.query, function(results) {
|
||||
res.json(results);
|
||||
|
Loading…
Reference in New Issue
Block a user