I am trying to delete a button on click from a layout itself . but unable to do it so far . I am new to ajax and jQuery . I have a div on web page showing pending actions in the form of buttons now I want to remove each button when user clicks on it. this web page is auto refreshed in every 1 minute and all these pending actions are stored in a session variable .
now I am not getting a way to send this button id to another php script so that it can delete it from session array.
I tried following ..
<script type='text/javascript'src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
function HideButton(butId)
{
$('#'+butId).hide();
deleteButton(butId);
}
</script>
<script>
function deleteButton(id) {
$.ajax({
url: "delete_button.php",
type: "POST",
data: "id=" + id,
success: function(response) {// Response handler}
});
}
</script>
<?php // here is my php code ..
//displaying button as follows in a loop
echo "<br><button type='button' id='".$id."' onclick=javascript:HideButton('".$id."') >".$pendingAction[$id]." </button>";
did not found any success yet.