I wrote two jQuery for set and unset button value, also when click on that button I pass value to backend using JQuery/Ajax.
<a class="btn invite">send invite</a>
when click on that link following jQuery is work,
$( ".invite" ).click(function() {
$.ajax({
type: "GET",
url: "example_1.php",
cache: false,
success: function (data) {
$('#requestFriendShip').html("Request Sent");
$('#requestFriendShip').removeClass('invite').off('click');
$('#requestFriendShip').addClass('remove');
}
});
});
then if again click on that change class, I try to follow this jQuery, but this is not working can someone please give me a solution,
$( ".remove" ).click(function() {
var requestFriendShip = $(this).attr('id');
$.ajax({
type: "GET",
url: "example_1.php",
cache: false,
success: function (data) {
$('#requestFriendShip').html("Send Invite");
$('#requestFriendShip').addClass('invite');
$('#requestFriendShip').removeClass('remove');
}
});
});