• 0

How to link to an ajax link onto a third party website?


Question

Hey guys,

Microsoft recently updated their xbox live website which caused most of their pages to be renamed somewhere else, and in the case of adding friends - it is now an ajax link.

For example you can see here: http://live.xbox.com/en-US/MyXbox/Profile?gamertag=Tx+XpLoSiV how the link to "Add to Friends List" calls a function in the ajax script instead of just being a straight link.

Here is the code for the javascript:

<script type="text/javascript" language="javascript">
//<![CDATA[
    function FriendCenterObject() {
        var fcAction = function(actionUrl, gamerTag, responseHandler) {
            responseHandler = responseHandler || function(response) {
                if (response.status != 0) {
                    DisplayMessageDialog('Error', response.view, 'Close', null, MessageLevelType.Error);
                }
                else {
                    DisplayMessageDialog('Message', response.view, 'Close', FriendCenter.RefreshContentAction);
                }
            }

            $.post(actionUrl, { 'gamerTag': gamerTag }, responseHandler);
        };

        this.AcceptFriendRequest = function(gamerTag) {
            fcAction('/en-US/FriendCenter/AcceptFriendRequest', gamerTag);
            return false;
        };

        this.DeclineFriendRequest = function(gamerTag) {
            DisplayConfirmationDialog(
                'Decline Friend Request',
                'Are you sure you want to decline the friend request?',
                'Yes',
                'No',
                function() {
                    fcAction('/en-US/FriendCenter/DeclineFriendRequest', gamerTag);
                }, null, '', MessageLevelType.Warning);
            return false;
        };

        this.CancelFriendRequest = function(gamerTag) {
            DisplayConfirmationDialog(
                'Cancel Pending Request',
                'Are you sure you want to cancel your pending friend request?',
                'Yes',
                'No',
                function() {
                    fcAction('/en-US/FriendCenter/CancelFriendRequest', gamerTag);
                }, null, '', MessageLevelType.Warning);
            return false;
        };

          this.AddFriend = function(gamerTag) {
            gamerTag = $.trim(gamerTag); // trim leading and trailing whitespaces
            if (gamerTag != "") {
                fcAction('/en-US/FriendCenter/SendFriendRequest', gamerTag);
            }
            return false;
        };

        this.RemoveFriend = function(gamerTag) {
            DisplayConfirmationDialog(
                'Remove',
                'Are you sure you want to remove this player from your friends list?',
                'Yes',
                'No',
                function() {
                    fcAction('/en-US/FriendCenter/RemoveFriend', gamerTag);
                }, null, '', MessageLevelType.Warning);
            return false;
        };

        this.BlockFriend = function(gamerTag) {
            DisplayConfirmationDialog(
                'Block User',
                'Are you sure you want to block this player from all further communications?',
                'Yes',
                'No',
                function() {
                    fcAction('/en-US/FriendCenter/BlockFriend', gamerTag);
                }, null, '', MessageLevelType.Warning);
            return false;
        };

        this.RefreshContentAction = function(){};
    };
    var FriendCenter = new FriendCenterObject();
//]]>
</script>

with the link itself being:

<a href="#" onclick="FriendCenter.AddFriend('Tx XpLoSiV')">Add to Friends List</a>

So how would I go about fixing my script to link, which you can see here, to the new method of adding friends to your xbox profile? I've tried every method I could think of trying to straight link it through somehow but nothing is working.

Any ideas?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.