Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ajax simulating a click
- <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.AddFriend = function(gamerTag) {
- gamerTag = $.trim(gamerTag); // trim leading and trailing whitespaces
- if (gamerTag != "") {
- fcAction('/en-US/FriendCenter/SendFriendRequest', gamerTag);
- }
- return false;
- };
- this.RefreshContentAction = function(){};
- };
- var FriendCenter = new FriendCenterObject();
- //]]>
- </script>
- <a href="#" onclick="FriendCenter.AddFriend('mirco')">Add to Friends List</a>
- jQuery("#iframeID").src = "path/to/site";
- //getting the content window html tag.
- var iFrame = document.getElementById("iframeID").contentWindow;
- jQuery(iFrame.body).find("#someID").click();
Advertisement
Add Comment
Please, Sign In to add comment