title: javascript empty text ajax
body: <p>I have a php script and i'm using ajax with it. I have a textarea form connect with the ajax class</p>
  
  <p>The problem when I pass a text like (<code>&amp;some text</code>) the function return an empty text, I guess that I have a problem with (<code>&amp;</code>).</p>
  
  <p>The javascript function:</p>
  
  <pre><code>function sendFormData(idForm, dataSource, divID, ifLoading)
  {
    var postData='';
    var strReplaceTemp;
  
    if(XMLHttpRequestObject)
    {
      XMLHttpRequestObject.open("POST", dataSource);
      XMLHttpRequestObject.setRequestHeader("Method", "POST " + dataSource + " HTTP/1.1");
        XMLHttpRequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  
      XMLHttpRequestObject.onreadystatechange = function()
      {
        if (XMLHttpRequestObject.readyState == 4 &amp;&amp;
            XMLHttpRequestObject.status == 200)
        {
          try
          {
            var objDiv = document.getElementById(divID);
            objDiv.innerHTML = XMLHttpRequestObject.responseText;
          }
          catch(e){document.write("sendFormData: getElementById(divID) Error");}
        }
        else
        {
          if(ifLoading)
          {
            try
            {
              var objDiv = document.getElementById(divID);
              objDiv.innerHTML = "&lt;img src=loading.gif&gt;";
            }
            catch(e){document.write("sendFormData-&gt;ifLoading: getElementById(divID) Error");}
          }
        }
      }
  
      for(i=0; i&lt;document.getElementById(idForm).elements.length - 1; i++)
      {
        strReplaceTemp = document.getElementById(idForm).elements[i].name;
        postData += "&amp;aryFormData["+strReplaceTemp+"][]="+document.getElementById(idForm).elements[i].value;
      }
  
      postData += "&amp;parm="+new Date().getTime();
      try
      {
        XMLHttpRequestObject.send(postData);
      }
      catch(e){document.write("sendFormData: XMLHttpRequestObject.send Error");}
    }
  }
  </code></pre>