I want to get the response text from php. I see it in the console as "responseText", but I can't get from my function codes variable.
When I run this code, console.log(query(path,"GET")), I see response in the screenshot. When I run this code console.log(query(path,"GET").responseText), I see only blank response.
PHP Code
<?php echo "Hi this is PHP Answer from Async XHR  request "; ?>
JavaScript Code
query=function(url,method){
    xhr=new XMLHttpRequest()
    xhr.url=url
    xhr.open(method,url,true)
    xhr.send()
    return xhr;
}
path="../../core/ajax/periyodikTarama.php"
console.log(query(path,"GET"))
Console Result
See the selected red text

 
    