I want to hide a dropdown list when user click radio button. For this am going to use AJAX instead of JS. Here, my code's :
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var element = document.getElementById("myDiv");
element.style.display = "";
**element.innerHTML=xmlhttp.responseText;**
}
}
xmlhttp.open("POST","**URL**",true);
xmlhttp.send();
}
</script>
Above element.innerHTML=xmlhttp.responseText & URL should i want to use ? there's no reason to pass ajax call to some other page. i done my work here. without URL script not worked. plz sort out me from this issue.
How about his,
function loadXMLDoc() // your suitable method name
{
var element = document.getElementById("myDiv");
element.style.display = "";
}
You dont need an ajax call ;)