mirror of
https://github.com/bvanroll/yahoo-thing.git
synced 2025-08-29 12:02:48 +00:00
HELP
This commit is contained in:
2
index.js
2
index.js
@@ -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', {data: arr[page],page:page,maxpages:arr.length()})
|
res.render('index', {data: arr[page],page:page,pagenums:Array.from(new Array(arr.length()), (x,i) => i),maxpages:arr.length()})
|
||||||
client.close()
|
client.close()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<form class="form-inline my-2 my-lg-0" action="/search" method="post">
|
<form class="form-inline my-2 my-lg-0" action="/search" method="post">
|
||||||
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="title">
|
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="title">
|
||||||
|
<input type="hidden" name="page" value="0">
|
||||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user