Upload pages without refresh by clicking the menu option

2

Good evening guys! I'm doing a school system, it will have access levels, menu for each access. I want to do the following, when I click on some option from the side menu, where it is written "BLANK" in the middle part, I want to appear the corresponding page, without changing page. Anyway, I did some previous applications with ajax, but it was not so good, I heard Angular and such, could you give me a direction? If you can only do it with ajax, or what angle is there for it? Well, I do not quite understand what it does, and if there is a framework for it, thank you in advance!

    
asked by anonymous 09.10.2017 / 01:19

1 answer

0

I do not think you need it so much, my friend. Via javascript you get what you need quickly and without the need for plugins. The solution is to encapsulate each page in a DIV and control the display property by switching between visible and invisible as the user action on the menu. Everything will be on a single page that will be shown where it is written "blank", but only the contents of one DIV will appear at a time.

function toggle(nome_da_div, estado) {
        var display = document.getElementById(nome_da_div).style.display;
        document.getElementById(nome_da_div).style.display = estado;
    }

By clicking on a menu item you can call the above function to change the visibility of the DIV:

toggle('div-nome-tal', 'block'); // visível
toggle('div-nome-tal', 'none'); // invisível

This is the simplest way to do it. However, if you want to use a plugin, I suggest that you look into Bootstrap that has a number of features ready for it:

link

    
09.10.2017 / 09:38