title: Ajax send parameters through url
body: <p>I'm new with ajax and thought i'd be a fun experiment to put into my project. I've created my own lightbox type feature to send a message on a website I'm creating. When the user clicks "Send Message", that's when the lightbox appears, and at the top I'm trying to get it to say "Send message to User", where User is the name of the user they're sending a message too. My lightbox html elements are actually on a seperate webpage, which is why I'm using ajax. this is what I have so far, and can't seem to figure out what the problem is:</p>
  
  <p>user.php page</p>
  
  <pre><code>&lt;div id = "pageMiddle"&gt; // This div is where all the main content is.
    &lt;button onclick = "showMessageBox(UsersName)"&gt;Send Message&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Note: The username passes correctly into the javascript function, I have checked that much.</strong></p>
  
  <p>main.js page</p>
  
  <pre><code>function showMessageBox(user){
    alert(user); // where i checked if username passes correctly
    var ajaxObject = null;
    if (window.XMLHttpRequest){
      ajaxObject = new XMLHttpRequest();
    }else if (window.ActiveXObject){
      ajaxObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (ajaxObject != null){
      ajaxObject.open("GET", "message_form.php", true);
      ajaxObject.send("u="+user);
    }else{
      alert("You do not have a compatible browser");
    }
    ajaxObject.onreadystatechange = function(){
      if (ajaxObject.readyState == 4 &amp;&amp; ajaxObject.status == 200){
        document.getElementById("ajaxResult").innerHTML = ajaxObject.responseText;
        // use jquery to fade out the background and fade in the message box
        $("#pageMiddle").fadeTo("slow", 0.2);
        $("#messageFormFG").fadeIn("slow");
      }
    };
  }
  </code></pre>
  
  <p>message_form.php page</p>
  
  <pre><code>&lt;div id = "messageFormFG"&gt;
    &lt;div class = "messageFormTitle"&gt;Sending message to &lt;?php echo $_GET['u']; ?&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Note: When accessing this page directly through the URL, giving it a parameter of u and a value, it displays correctly</strong></p>