Results 1 to 3 of 3

Thread: Firefox ajax

  1. #1
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default Firefox ajax

    Code:
    <script type="text/javascript">
    function addrep(){
    
    alert('Sorry - but you cannot add reputation to <?php echo $propername; ?>!');                
    }
    function send()
    {
      var url = 'send.php?from=<?php echo $nivusr; ?>&type=message';
      if(window.XMLHttpRequest)
      {  
        httpAjax = new XMLHttpRequest();
      }
      else if(window.ActiveXObject)
      {
        httpAjax = new ActiveXObject("Microsoft.XMLHTTP");
      }
      httpAjax.open("POST", url, true);
      httpAjax.onreadystatechange = saved;
      httpAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      httpAjax.send();
    }  
    
    function addfriend()
    {
      var url = '../friend.php?from=<? echo $nivusr; ?>&add=<? echo $propername; ?>';
      if(window.XMLHttpRequest)
      {  
        httpAjax = new XMLHttpRequest();
      }
      else if(window.ActiveXObject)
      {
        httpAjax = new ActiveXObject("Microsoft.XMLHTTP");
      }
      httpAjax.open("POST", url, true);
      httpAjax.onreadystatechange = saved;
      httpAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      httpAjax.send();
    }  
    function saved() {
    alert("A friend request has been dispatched too <?php echo $propername; ?>\n\nYou have to wait for <?php echo $propername; ?> to accept the request!");
    }
        </script>
    Sorry to hastle, but please could someone fix this code too work in Firefox, I'm not too sure why but this code only works in Internet explorer.

    +REP to anybody who helps.

  2. #2
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Why not use Prototype and then just use Ajax.Request, and it works crossbrowser.

  3. #3
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    Why not use Prototype and then just use Ajax.Request, and it works crossbrowser.
    I suck with javascript more than I do with PHP, but thanks will try see into it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •