This commit is contained in:
2019-02-28 20:24:24 +00:00
parent b89a93f379
commit d4270c4e70
2 changed files with 3 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ app.post('/search', (req, res) => {
temp = client.db().collection("questions").find(query).toArray(function(err, data) { temp = client.db().collection("questions").find(query).toArray(function(err, data) {
arr = splice(data) arr = splice(data)
page = 0 + parseInt(req.body.page, 10) page = 0 + parseInt(req.body.page, 10)
res.render('index', {search:req.body.title, data: arr[page],page:page,pagenums:Array.from(new Array(arr.length), (x,i) => i),maxpages:arr.length}) res.render('index', {title:req.body.title, data: arr[page],page:page,pagenums:Array.from(new Array(arr.length), (x,i) => i),maxpages:arr.length})
client.close() client.close()
}) })
}); });

View File

@@ -21,10 +21,10 @@
</div> </div>
<div class='bottomthing'> <div class='bottomthing'>
<form action='/search' method='post'> <form action='/search' method='post'>
<input type="hidden" value="{{this.search}}"> <input type="hidden" name='title' value="{{this.title}}">
<ul> <ul>
{{#each this.pagenums}} {{#each this.pagenums}}
<li><input type="submit" value="{{this}}">{{this}}</input></li> <li><input type="submit" name='page' value="{{this}}">{{this}}</input></li>
{{/each}} {{/each}}
</ul> </ul>
</form> </form>