Issue : if i call ajax function i can't able to get return value.
Below is my simple javascript and ajax file.
Javascript Ajax
<script type="text/javascript">
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
return this.responseText;
}
};
xhttp.open("GET", "testAjax.php", true);
xhttp.send();
}
alert(loadDoc());
</script>
PHP
<?php
echo "Hello World !!!";
?>
Can synchronous
or asynchronous
concept are useful to this problem ?
Thank you.