C
C#9mo ago
Ares

[ASP.NET CORE MVC] trying to add js dependency to my project, but its not being recognized.

Im trying to add a pagination library to my app, but the script is not working when i add the script tag to my view and try to use it. I know that the src for my script tag is correct because when i use postman to get the file or visit it in the browser, i see all of the paginationjs code. I also know that Jquery is working because I can select elements and do stuff with it with jquery when i tested it. But for some reason when i try to call paginationjs pagination function, it says "?page=1:364 Uncaught (in promise) TypeError: $(...).pagination is not a function at populateGrid (?page=1:364:41)" This is also the function I am trying to run:
<script src="~/js/pagination.js"></script>

<script>
$(document).ready(function () {
const populateGrid = async () => {
const { polls, pollCount } = await getData()
$('#pagination-container2').pagination({
dataSource: polls,
callback: function (data, pagination) {
// template method of yourself
var html = template(data);
$('#data-container').html(html);
}
})


}
populateGrid();
});
</script>
<script src="~/js/pagination.js"></script>

<script>
$(document).ready(function () {
const populateGrid = async () => {
const { polls, pollCount } = await getData()
$('#pagination-container2').pagination({
dataSource: polls,
callback: function (data, pagination) {
// template method of yourself
var html = template(data);
$('#data-container').html(html);
}
})


}
populateGrid();
});
</script>
I also tried right clicking on lib > add > client side library and installing paginationjs that way, and i saw it in my libman.json. I then added the script tag for that directory but i still had the same problem. I tried installing wiht npm too but no luck. how can i fix this? thanks. https://github.com/ForkEyeee/realtime-poll/blob/main/realTimePollsApp/Views/Home/Index.cshtml
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server