Relative Content

Tag Archive for javascripthtmlasp.net-mvcfetch-api

Implications of loading whole HTML pages/components using XHR/Fetch calls

I have an application with raw Javascript on the front-end built into an ASP.NET MVC application. I have decided to make it into a Single-Page Application, with the content being loaded using ASP.NET’s View Components. In order to achieve this, whenever the user requests the content I am making a Fetch call to the server side Home Controller’s method, which renders and returns the relevant View Component’s HTML. I am then simply parsing that HTML into a div container on the page, like in the example below: