When the page loads I have an initial replaceWith that runs the following code:
<span id="requestAlert>"
<span class="font1">wants to be your friend </span>
<input type="submit" id="acceptRequest" value="Accept" style="width: 60px;
height: 28px" class="button1" />
<input type="submit" id="denyRequest" value="Deny" style="width: 50px;
height: 28px" class="button1" />
</span>
Then I have the following code that is suppose to manipulate the code above when the page is finished loading:
$("#acceptFriend").live('click', function() {
acceptFriend();
});
function acceptFriend() {
var targetedUserId = $(document).getUrlParam("id");
jQuery.ajax({
type: "POST",
dataType: "JSON",
url: "<?=base_url()?>index.php/regUserDash/acceptFriend",
data: { targetedUserId: targetedUserId },
json: {acceptFriendSuccess: true},
success: function(data) {
if(data.acceptFriendSuccess == true) {
$("#requestAlert").replaceWith('<span class="font1">You two are noe friends</span>');
}
}
});
}
I cannot seem to get the above code to manipulate the initial replaceWith code. I thought maybe .live() would do the trick but apparently not. Any ideas as to why it won’t worK? Any solutions?
Your input has the id
acceptRequestwhile your jQuery has the idacceptFriend.