Guest User

Untitled

a guest
Jun 22nd, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. Ajax simulating a click
  2. <script type="text/javascript" language="javascript">
  3. //<![CDATA[
  4. function FriendCenterObject() {
  5. var fcAction = function(actionUrl, gamerTag, responseHandler) {
  6. responseHandler = responseHandler || function(response) {
  7. if (response.status != 0) {
  8. DisplayMessageDialog('Error', response.view, 'Close', null, MessageLevelType.Error);
  9. }
  10. else {
  11. DisplayMessageDialog('Message', response.view, 'Close', FriendCenter.RefreshContentAction);
  12. }
  13. }
  14. $.post(actionUrl, { 'gamerTag': gamerTag }, responseHandler);
  15. };
  16. this.AddFriend = function(gamerTag) {
  17. gamerTag = $.trim(gamerTag); // trim leading and trailing whitespaces
  18. if (gamerTag != "") {
  19. fcAction('/en-US/FriendCenter/SendFriendRequest', gamerTag);
  20. }
  21. return false;
  22. };
  23. this.RefreshContentAction = function(){};
  24. };
  25. var FriendCenter = new FriendCenterObject();
  26. //]]>
  27. </script>
  28.  
  29. <a href="#" onclick="FriendCenter.AddFriend('mirco')">Add to Friends List</a>
  30.  
  31. jQuery("#iframeID").src = "path/to/site";
  32.  
  33. //getting the content window html tag.
  34. var iFrame = document.getElementById("iframeID").contentWindow;
  35. jQuery(iFrame.body).find("#someID").click();
Advertisement
Add Comment
Please, Sign In to add comment