In the previous page layout, if the page needs to have all HTML tags related to it, this causes a page with a lot of content, when you view the source file, it is inconvenient to compile and maintain a large string of code. In this case, you can think of writing different functional items in different
In the previous page layout
Then there must be
When there is a lot of content in a page, it is inconvenient to compile and maintain a large string of code when you view the source file, at this time, we can think of writing different function items in different JS files and combining them in front-end JS. This is the JS function module to be discussed in this article.
Create a project
Create an MVC project and create a new Index. cshtml page
Introduce Newtonsoft. Json. dll and add references to introduce json2.js and jquery-1.7.1.min.js
Page Layout
Using JS Modular programming, you do not need to manually add every tag to an HTML page. You should dynamically add HTML tags to another JS file, while the front-end page only needs to layout the page, this layout refers to placing only the DIV elements of each section. The complete front-end Page code is as follows:
Home Page