Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Gostaria de saber como faço para limitar carregar todo o jquery no inicio da pagina, pois ao abrir tem uma lista de 920.000 mil ceps e demora muito, sendo assim queria carregar em um limite por pagina se possivel, alguem saberia me dizer?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LOCALIZAR CEPS</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="media/jquery.tablesorter.min.js"></script>
<script src="media/jquery.tablesorter.pager.js"></script>
<link rel="stylesheet" href="media/custom.css" media="screen" />
</head>
<body>
<?php
$host="localhost";
$user="root";
$senha="";
$db= mysql_connect ($host, $user, $senha) or die ("falha na conexao do servidor");
$selecionar= mysql_select_db ("loja") or die ("falha na conexao com o banco");
?>
<div id="menu">
<ul>
<li><a href="localizaCEP.php">Locializar por CEP</a></li>
<li><a href="localizacidade.php">Localizar por CIDADE</a></li>
</ul>
</div>
<form method="post" action="exemplo.html" id="frm-filtro">
<p>
<label for="pesquisar">Pesquisar</label>
<input type="text" id="pesquisar" name="pesquisar" size="30" />
</p>
</form>
<div id="tabela"></div>
<table cellspacing="0" summary="Tabela de dados fictícios">
<thead>
<tr height="40px">
<th><input type="checkbox" value="1" id="marcar-todos" name="marcar-todos" /></th>
<th>Código</th>
<th width="450px">Cidade</th>
<th>Estado</th>
<th>Cep</th>
<th>Editar</th>
<th>Excluir</th>
</tr>
</thead>
<?php
$sql3= "SELECT z.*,s.* FROM isc_shipping_zone_locations z, isc_shipping_zones s WHERE z.zoneid = s.zoneid ";
$qry3 = mysql_query($sql3);
while ($pedido3 = mysql_fetch_array($qry3))$estado = $pedido3["locationvalueid"];
$estado2 = $pedido3["zoneid"];
$sql="SELECT * FROM isc_country_states WHERE stateid='$estado'";
$qry= mysql_query($sql);
$local = mysql_fetch_array($qry);
$est = $local["statename"];
$sqlestado="SELECT * FROM cidade_estado WHERE zoneid='$estado2'";
$qryestado= mysql_query($sqlestado);
$localestado = mysql_fetch_array($qryestado);
$locasestado= $localestado["nome"];
$sqlcountry="SELECT * FROM isc_country_states WHERE stateid='$locasestado'";
$qrycountry= mysql_query($sqlcountry);
$localestado = mysql_fetch_array($qrycountry);
$nomeestado = $localestado["statename"];
?>
<tr>
<td><input type="checkbox" value="1" name="marcar[]" /></td>
<td id="tabela1"><?php echo $pedido3["locationid"];?></td>
<td><?php echo $pedido3["zonename"];?></td>
<td><?php echo $local["statename"]; ?><?php echo $nomeestado; ?></td>
<td><?php echo $pedido3["locationvalue"];?></td>
<td><a href="editar_entrega.php?&id=<?php echo $pedido3["zoneid"] ?>&id2=<?php echo $pedido3["locationid"] ?>"><img src="media/edit.png" width="16" height="16" /></a></td>
<td><a href="deletar_mysql_cep.php?&id=<?php echo $pedido3["zoneid"] ?>&id2=<?php echo $pedido3["locationid"] ?>"><img src="media/delete.png" width="16" height="16" /></a></td>
</tr>
<?php } ?>
</table>
<div id="pager" class="pager">
<form>
<span>
Exibir <select class="pagesize">
<option selected="selected" value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
</select> registros
</span>
<img src="media/first.png" class="first"/>
<img src="media/prev.png" class="prev"/>
<input type="text" class="pagedisplay"/>
<img src="media/next.png" class="next"/>
<img src="media/last.png" class="last"/>
</form>
</div>
<script>
$(function(){
$('table > tbody > tr:odd').addClass('odd');
$('table > tbody > tr').hover(function(){
$(this).toggleClass('hover');
});
$('#marcar-todos').click(function(){
$('table > tbody > tr > td > :checkbox')
.attr('checked', $(this).is(':checked'))
.trigger('change');
});
$('table > tbody > tr > td > :checkbox').bind('click change', function(){
var tr = $(this).parent().parent();
if($(this).is(':checked')) $(tr).addClass('selected');
else $(tr).removeClass('selected');
});
$('form').submit(function(e){ e.preventDefault(); });
$('#pesquisar').keydown(function(){
var encontrou = false;
var termo = $(this).val().toLowerCase();
$('table > tbody > tr').each(function(){
$(this).find('td').each(function(){
if($(this).text().toLowerCase().indexOf(termo) > -1) encontrou = true;
});
if(!encontrou) $(this).hide();
else $(this).show();
encontrou = false;
});
});
$("table")
.tablesorter({
dateFormat: 'uk',
headers: {
0: {
sorter: false
},
5: {
sorter: false
}
}
})
.tablesorterPager({container: $("#pager")})
.bind('sortEnd', function(){
$('table > tbody > tr').removeClass('odd');
$('table > tbody > tr:odd').addClass('odd');
});
});
</script>
</body>
</html>Carregando comentários...