I'm trying to get data through ajax and php. What I'm trying to do is have a list of several ids and that ajax shows them to me dynamically. My client wants to see a list of messages by clicking on each one, something like the icloud inbox.
JQuery:
$(document).ready(function(){
$('.enlaceajax').click(function(){
$.ajax({
type: 'GET',
url: 'pagina-lenta.php',
dataType: 'html',
success: function (data) {
$('.destino').html(data);
}
});
});
});
HTML:
<a href="<?=$fila['id'];?>">class="enlaceajax"></a>
<div class="destino"></div>
PHP:
$ide = $_GET['id'];
if($ide == 1) {
echo 'Texto de ID 1';
}else {
echo 'Error';
}
The error is that it does not give me any results. I do not know what I'm doing wrong, I hope you help me. Thanks.