Jquery returns "0" in div

0

I have a ajaxForm function that searches some data in the database and should return the HTML result in a div. The problem is that when I inspect the page the return is correct, but in div only the number "0" appears. Can anyone help?

Form:

<form class="form-inline" method="POST" id="pesquisa" action="">
            <fieldset>
                <div class="col-sm-8">
                    <div class="form-group">
                        <input type="btn" id="movimenta" name="movimenta" class="form-control" aria-describedby="basic-addon2">
                        <select class="form-control" id="galpao" name="local">
                            <option>Selecione o local</option>
                            <?php
                            while($linha = mysqli_fetch_assoc($galpao)){?>
                            <option value="<?php echo $linha['id']; ?>"><?php echo $linha['nome']; ?></option>
                            <?php }?>
                        </select>
                        <input type="submit" class="form-control" id="pesquisaGalpao" value="Pesquisar">
                    </div>
                </div>
            </fieldset>
        </form>

Div:

<div class="info">0</div>

Ajax code:

$(document).ready(function(){
    $('#pesquisa').ajaxForm({
        target:'.info',
        url:'sql.php',
        success: function(msg){
            $(".info").html(msg);
        }
    });
});

Return shown when I inspect the page:

<section class="panel col-lg-12">
        <table class="table table-striped table-bordered table-hover table-checkable order-column" id="">
        <thead>
            <tr>
                <th> Código</th>
                <th> Descrição </th>'

What the form sends:

movimenta:grampo
local:11

What returns from the sql.php page:

Código  Descrição   Galpão  Rua Coluna  Altura  Qtde    Lote    Validade    Movimentar
12345678901234  GRAMPO  Armazem 01  1   2   0   15
    
asked by anonymous 27.06.2017 / 18:52

1 answer

0

You seem to be using this jQuery Form Plugin . If this is the case, it's strange to me that you use the option object both the target property, which "... identifies the element to be updated with the server response", and a callback in the success property that populates this same element that target is trying to update. Try to use only one of the two - ordinarily, I would say to comment on success and keep target , but check out the other possibility if the first one does not work.

    
28.06.2017 / 15:24