Is there a way you can reference a cshtml file in a javascript file. For example I have an Index.cshtml that displays a modal to sign up. I want to reference this modal in my javascript file to display when the page is loaded.
You can load the content of views (or even razor pages if you are serving those directly) into an element (often a div) using jQuery like this:
$("#yourdiv").load("@Href("~/Controller/Action"))
or
$("#yourdiv").load("@Href("~/Path/to/file.cshtml"))
This will load the content of the view into the DOM element.