I am trying to post some data to a php file by using following code.
var exam = document.getElementById("information").getAttribute("examid");
var user = document.getElementById("information").getAttribute("userid");
var question = document.getElementById("information").getAttribute("questionid");
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","savevalue.php?examid="+exam+"&userid="+user+"&questionid="+question+"&content="+ editor.getValue(),true);
xmlhttp.send();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
}
}
But the first problem is if the variable that I am posting contains too many characters, this method fails. Secondly if one of the variables that I am posting contains '&' char, it also fail. Should I replace &
with something else?