First Problem:When user deleted particular row then i have to remove that row only with out page refresh. Deleting row using ajax. How can i do thisSecond Problem: Actually i am calculating the when ever page hits from that day to previous 7 days. But i want when page hits today i have to retrieve previous week Means from sunday(20 …
via PHP Website Development » Search Results » ajax:
How i can remove particualr row from table using jquery
First Problem:
When user deleted particular row then i have to remove that row only with out page refresh. Deleting row using ajax. How can i do this
Second Problem: Actually i am calculating the when ever page hits from that day to previous 7 days. But i want when page hits today i have to retrieve previous week Means from sunday(20 Nov 2011) to saturday (20 Nov 2011) When page hits on next monday so i have to retrieve this week records Means from sunday(27 Nov 2011) to saturday (03 Dec 2011)
function authenticate()
$.ajax(
type: “POST”,
url: “authentication.php”,
data: $(“#login_form”).serialize(),
success: function(msg)
if(msg==1)
$(‘#delete’).html(“success”); //if success message appear only i have to remove particular row
)
}else
$(‘#delete’).html(“error”);
},
error:function(msg)
alert(msg);
$(‘#delete’).dialog(“close”);
});
}
Title | Public Id | Pass | |
---|---|---|---|
‘ . $title . ‘ | ‘ . $publicId . ‘ |
………………………………………
You can use jQuery’s nth-child selector.
$(“table#mytableid tr:nth-child(2)”).remove();This will remove the second row, for example. Make sure your table has an ID or a class so that you select it more easily (not accidentally removing 2nd row of EVERY table on the page, in case you have more)…
EDIT
From what I see in your code, you could select the parent tr element from your onclick event and then either send it to the function as a new parameter (which you would remove it the ajax returns success) or remove it right away… or whatever you want.
………………………………………
$(‘#myTableRow’).remove();
This works fine if your row has an id, such as:
For more info: How i can remove particualr row from table using jquery
PHP Website Development » Search Results » ajax