Hello, I am writing an SPA using asp.net(MVC) and I don't want to use a framework (angular/react/whatever) because I don't have time to learn it and I am not that friendly with front-end development.
Anyway, I figured I could create an Object in the main page, and then for each partial view called, I add my elements to the main object (after setting it to null).
I wrote my script inside the html file, I could of course write the scripts on an external .js but the file will remain on the browser's memory.
What are the cons of this approach?
Anyway, I figured I could create an Object in the main page, and then for each partial view called, I add my elements to the main object (after setting it to null).
I wrote my script inside the html file, I could of course write the scripts on an external .js but the file will remain on the browser's memory.
What are the cons of this approach?
<script>
//main var
mainObj = {}
</script>
//Script Inside the page
<script>
$(function(){
mainObj = null
mainObj.foo = "foo"
mainObj.bar = function(){}
})
</script>