i have a php script and i'm using ajax with it . i have a textarea form connect with the ajax class
the problem when i pass a text like ( &some text ) the function return an empty text ,i geuess that i have a problem with (&) , what is the problem here ?
here the javascript function
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 &&
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 = "<img src=loading.gif>";
}
catch(e){document.write("sendFormData->ifLoading: getElementById(divID) Error");}
}
}
}
for(i=0; i<document.getElementById(idForm).elements.length - 1; i++)
{
strReplaceTemp = document.getElementById(idForm).elements[i].name;
postData += "&aryFormData["+strReplaceTemp+"][]="+document.getElementById(idForm).elements[i].value;
}
postData += "&parm="+new Date().getTime();
try
{
XMLHttpRequestObject.send(postData);
}
catch(e){document.write("sendFormData: XMLHttpRequestObject.send Error");}
}
}