Fill div content from a select

Asked

Viewed 177 times

0

Good afternoon, I would like to fill the contents of a panel from a data chosen in select.

My code seems correct, follows below what I have so far:

HTML

<div class="panel panel-primary">
<div class="panel-heading" data-toggle="tooltip" data-placement="bottom" title="Aqui apresentamos a os responsáveis por Hosting">
    <div class="row">
        <div class="col-lg-8">
            <h4>Hosts - Pontos Críticos - <?php echo date('d/m/Y',strtotime($data_recente)); ?></h4>
        </div>
        <div class="col-lg-4">
            <form>
                <div class="form-group">
                    <label>Período de tempo:</label>
                    <select class="form-control"  id="tempo">
                        <option>-----</option>
                        <option value="sem">Última Semana</option>
                        <option value="mes">Último Mês</option>
                        <option value="tri">Último Trimestre</option>
                    </select>
                    <input type="button" class="btn btn-success btn-sm" id="mostrar" value="OK"></input>
                </div>
            </form>
        </div>
    </div>
</div>
<div class="panel-body" id="conteudo">
<!-- LOAD DA TABELA -->
</div>

JAVA SCRIPT:

    $(document).ready(function(){
    $("#mostrar").click(function(){
    var tabID = $("#tempo").val();
    $("#conteudo").load("/var/www/html/novo/pages/capacidade/relatorios/tic/hosting/tabela_crit.php?id="+tabID);
    alert('ok');
});

});

tabela_crit.php:

From a switch in $tabID she makes a query and then fills a table.

I await answers. Thank you.

  • 2

    Good afternoon, you are getting to the php script with this path (/var/www/html/novo/pages/capacidade/relatorios/tic/hosting/tabela_crit.php)? you can check the tab Network of Developer Tool and see if you didn’t return a 404? I ask this because this path is absolute from the server and you are probably running a local pro php server, correct? For example, if you are using an Apache and your DocumentRoot for /var/www/html, you should call /novo/pages/capacidade/....

  • That was just the problem, thank you very much, I was already desperate here because I found no errors in the code.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.