When making a query to the database, it generates a response that is received by the success function of ajax, but when I want to put $. each , it is not that I have a problem with that, no and no, the json is parsed, everything is fine, only that it generates more responses than the server gives, for example, a single message comes out and returns approximately 11.
success: function(response){
$this = $(this).children(".messages");
response = JSON.parse(response);
$.each(response, function(){
console.log(response);
$('<div class="message-sent">' + response.message + '</div>').appendTo($this);
})
$this.append(response);
}
As I put it above, first I make a console.log, the array appears with the same number of results that the answer delivers, but when sent by $ .each they multiply infinitely, that is. help