I have the following script which displays data returned from a serverside page onto the clientside page:
function getResults() {
var search;
search = $(".txtSearch").val();
$.ajax({
url: 'search.aspx',
type: 'POST',
data: { strPhrase:search },
error: function(xhr, status, error)
success: function(results)
{
$("#ResultsContainer").empty();
$("#ResultsContainer").append(results);
}
});
}
Is it possible to check the results returned as they are being appended and make changes to it?
For example, imagine the results returned is html as follows:
<div><a href="link1.xls">link 1</a></div>
<div><a href="link2.xls">link 2</a></div>
<div><a href="link3.doc">link 3</a></div>
<div><a href="link4.xls">link 4</a></div>
Is it possible to check for .doc in the links and remove the full div around that particular link leaving just the following?
<div><a href="link1.xls">link 1</a></div>
<div><a href="link2.xls">link 2</a></div>
<div><a href="link4.xls">link 4</a></div>