Hi I tried to post data from my Text Area to DIV tag. But its not working. Please help me out. Following is my code
<html>
<head>
<script>
function load()
{
var a=document.getElementById('txtarea').value;
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","one.php"+a,true);
xmlhttp.send();
}
</script>
</head>
<body onload="load()">
<textarea id='txtarea'>
default
</textarea>
<div name="myDiv" id="myDiv">
In Div Tag
</div>
</body>
</html>
one.php
<?php
echo "Hello World";
?>
In the above html file i am trying to get the value of one.php and also the text in textarea. But i am unable to get the value in text area.The xmlhttp.open(“POST”,”one.php”+a,true); Here i am doing +a to attach the value of the textarea but it is not being attached,please help with some solution
URL is not properly constructed.