Jump to content
peterpah

Não me carregar os dados

Recommended Posts

peterpah

Eu carrego para apresentar os 5 dados seguintes e não apresenta alguém me pode dizer onde ta o erro sff ?


<script type="text/javascript" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript" language="javascript">
$(function($) {

$("#mais").click(function() {

var ultimo = $("#frases p:last").attr("lang");

$("#status").html("<img src='images/loader.gif' alt='Enviando' /><br>");

$.post("ajax/buscar.php", {ultimo:ultimo}, function(resposta) {

$("#status").empty();

$("#frases").append(resposta);
});
});
});
</script>
<?php
include "cont.php";
$query = mysql_query('SELECT * FROM anedota ORDER BY id_anedota LIMIT 0,5');
while ($row = mysql_fetch_object($query))
echo"<div class='post'>
<a href='verand-{$row->titulo}-{$row->id_anedota}'><h2>$row->titulo</h2></a>
<p lang='{$row->id_anedota}'>$row->anedota</p>

</div>";
?>

<div id="carregar"><span id="status"></span> <a href="javascript:func()" id="mais">Mais frases </a></div>

busca.php

<?php
require_once('../cont.php');
$ultimo = (int) $_POST['ultimo'];
if ($ultimo==0)
{
echo "ERRO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
}
else{
$query = mysql_query("SELECT * FROM anedota WHERE id_anedota < $ultimo ORDER BY id_anedota DESC LIMIT 0,3");
while ($row = mysql_fetch_object($query))
echo"<div class='post'>
<a href='verand-{$row->titulo}-{$row->id_anedota}'><h2>$row->titulo</h2></a>
<p lang='{$row->id_anedota}'>$row->anedota</p>
</div>";
}
?>

Obrigada

Edited by yoda

Share this post


Link to post
Share on other sites
HappyHippyHippo

faz a verificação que a função de leitura de dados sucedeu usando a função mysql_error


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites
HappyHippyHippo

desconfio que a função "func" não exista ...

<a href="javascript:func()" id="mais">Mais frases </a>

o que estará a estoirar o javascript, algo que deverias verificar e fazer post dos erros apresentados


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.