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