Should you put HTML code in your JavaScript or call it from the server? -
I am working on a system that uses liter API to create a map that shows data. I can put a control bar on the map, allowing me to interact with the map. The content of this control bar is HTML Now, my question:
Should I create HTML of this control bar in Javascript that is sent to the client, or do I have to use my ASP.NET controller Call the control bar with an AJAX call? ? Some professional and cons of each approach: If I create a control bar in Javascript, then my JS file will become a messier. By placing the control bar in many HTML ASP.Net pages, HTML and Javascript will be released, which is a positive thing for me. It saves a request to the server, because the code is already sent with JS files to create control bar. Putting it into an ASP.NET page means that the JS file is small, but the application needs to make an additional call on the server to get the control bar. There is no such situation where there is no control panel on the map, so calling the server is always possible if I store the HTML in the ASP.Net page. Does anyone have to deal with this issue in the past, and how do you handle it? Put HTML for your control bar in the ASP.Net page, it defines the structure. I think behavior and style in JavaScript and CSS files Depending on the content of your bar, putting HTML in the ASP.Net page will give you the benefit of keeping content in the HTML visible to the search engine spider.
Comments
Post a Comment