im new in javascript and php , my goal is :RETURN string from xmlhttp responseText to a function return value.So i can use it with innerText or innerHTML method. the html code :
<script>
function loadXMLDoc(myurl){
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
xmlhttp.responseText;}
}
xmlhttp.open("GET",myurl,true);
xmlhttp.send();
}
</script>
innerText
: it's a Microsoft proprietary member, and although is supported by Chrome it isn't by Firefox for example. Use it as a fallback iftextContent
isn't supported (IE8 and older). – Nectareous