Good evening people, so .. I have an ajax code that catches a loop inside a php file and then inserts the result into an html page. So far, everything works. The problem is at the time I want to manipulate some class that was entered using .html () from jquery, which it simply does nothing. As if that class did not exist.
Code php:
if ($stmt->num_rows != 0) {
while($stmt->fetch()) {
$info = substr($info, 0, 100);
echo '<div>
<a class="uk-link-reset" href="detalhes?id='.$id.'">
<div class="uk-card uk-card-default uk-card-hover">
<div class="uk-card-media-top">
<img class="imagem_produto" src="'.$imagem.'">
</div>
<div class="uk-card-body">
<h6>'.$nome_categoria.'</h6>
<h2 class="uk-card-title uk-margin-small-top">'.$nome.'</h2>
<p class="uk-text-justify">'.$info.'...</p>
<div class="uk-grid-collapse uk-child-width-expand@s uk-text-center" uk-grid>
<div>
<div class="uk-background-muted uk-padding-small">R$ '.$valor_novo.'</div>
</div>
</div>
</div>
</div>
</a>
</div>';
}
}
Ajax code:
$.ajax({
type: 'POST',
dataType: 'html',
url: 'processos/produtos.php',
success: function(data) {
$(".produtos").html(data);
}
});
Then if I do, a simple one:
$(".uk-text-justify").click(function(){alert('algo')});
It does not work.