I am appending a span with onclick. I cant change this because I am getting an HTML via PHP from another website.
So, I am adding in a table some informations like this:
function getdados(id) {
$('#loader').fadeIn();
$.ajax({
type: "GET",
url: 'index.php',
data: { action: 'getdados', id: id },
success: function(response) {
if(count > 1) {
$('.remove').remove();
console.log(count);
}
response = response.replace(/\+/g, '%20');
var str = response.split("%");
var cval = str[0];
for (var i = 1; i < str.length; i++) {
cval += String.fromCharCode(parseInt(str[i].substring(0,2),16))+str[i].substring(2);
}
jQuery.event.trigger("ajaxStop");
$('.resultados').append(cval);
var titles = $(".title").map(function() { return $(this).text(); }).get(),
dados = $(".dados").map(function() { return $(this).text(); }).get(),
header = $(".headertitle").map(function() { return $(this).text(); }).get();
for(var i = 0; i < dados.length; i++) {
switch(titles[i]) {
case 'Naturesa: ':
titles[i] = 'Natureza: ';
dados[i] = dados[i] + ' - ' + dados[i+1];
dados.splice(i+1, 1);
titles.splice(i+1, 1);
break;
case 'DOC: : ':
titles[i] = 'DOC: ';
break;
case 'Atividade primária: ':
dados[i] = dados[i] + ' - ' + dados[i+1];
dados.splice(i+1, 1);
titles.splice(i+1, 1);
break;
case 'Atividade secundária: ':
dados[i] = dados[i] + ' - ' + dados[i+1];
dados.splice(i+1, 1);
titles.splice(i+1, 1);
break;
}
$('#results-2 table').append('<tr class="remove"><th>'+ titles[i] +'</th><td>'+ dados[i] +'</td></tr>');
}
for(var i = 0; i < header.length; i++) {
var link = $('.headertitle').eq(i).nextUntil('.headertitle').map(function() {
if(this.localName == 'span')
return '<tr class="remove"><td colspan="2">'+this.outerHTML+'</td></tr>';
}).get().join('');
$('#results-2 table').append('<tr class="remove rowTable"><th colspan="2">'+ header[i] +'</th></tr>'+link);
}
$('#loader').fadeOut();
},
error : function(transport) {
jQuery.event.trigger("ajaxStop");
}
});
}
I need to remove all tr class="remove" from the table, but I think it is not possible :(
Someone can help me?