0
good afternoon! My Jquery is adding the results obtained via ajax and they are disappearing. What might be happening? And how to solve? Thank you
var _urlSearchInput;
var _urlSearch;
$('#vai').click(function(){
_urlSearchInput = $('#campo-busca').val();
_urlSearch = window.location.origin + "/search/" + _urlSearchInput + "/";
//alert(_urlSearch);
//alert(_urlSearchInput);
$.ajax({
url: _urlSearch,
dataType: "json",
type: "post",
success: function(json) {
var html;
var matias = json;
if(typeof json == 'string'){
matias = JSON.parse(json);
}
for(item in matias){
html += '<div class="media wow fadeInDown animated" style="visibility: visible; animation-name: fadeInDown;">';
if (typeof matias[item].midias['102x112'] != 'undefined'){
html += '<a href="#" class="media-left">';
html += '<img alt="" src="' + matias[item].midias['102x112'] + '">';
html += '</a>';
}
html += '<div class="media-body">';
html += '<h4 class="media-heading">';
html += '<a href="'+ matias[item].url +'">' + matias[item].title + '</a>';
html += '</h4>';
html += '<p>' + ( !matias[item].description ? '' : matias[item].description) + '</p>';
html += '</div>';
html +='</div>';
}
$('#resultados-busca').append(html.replace("undefined", ""));
}
});
});
tries to remove this class
animated
looks like it’s an animation ofCSS
– Hebert Lima
I’ve tried... tried without any CSS class and still nothing.
– Diego Albuquerque
the elements remain in the
DOM
or are removed? adds areturn false;
before closing the last key of thesuccess
;– Hebert Lima
The elements do not remain in the DOM. They are created and then disappear. I added the Return false before closing the sucess key... nothing has changed. =/
– Diego Albuquerque
can add a feedback from your json for me to do a test here?
– Hebert Lima
How should I proceed to simulate this? The data is being passed through an internal server..
– Diego Albuquerque