Reputation:
This one makes me nuts:
I am getting a complete page in success callback of jquery ajax call.
I get page as:
<html>
<head>
<title>Title</title>
<body>
<table></table>
<table></table>
<table></table>
<table></table>
<table></table>
<table></table>
<table></table>
<table></table>
<table></table>
</body>
</html>
I want to remove the last table tag completely in my code which is rendered. I tried using parent() but to no luck
Here is my ajax call:
$ajax({method: get,url:'mypage.cfm',success: function(data) { $(".mycontainer").html(data)});
Upvotes: 1
Views: 42
Reputation: 2655
This may help you out. I had not tried but it should work.
$ajax({method: get,url:'mypage.cfm',success: function(data) {
$(".mycontainer").html(data).find("table:last-child").remove();
});
Upvotes: 0
Reputation: 4937
You could try with this:
$ajax({method: get,url:'mypage.cfm',success: function(data) {
$(".mycontainer").html(data);
$(".mycontainer").find("table:last").remove();
});
Upvotes: 1