Javascript – AJAX Uncaught reference error

ajaxjavascript

Script.js:

var request = new XMLHttprequest(); 

request.open('GET','data.txt',false);   

if(request.status===200) {   
    console.log(request);   
    document.writeln(request.responseText);
}

This is my javascript file. I am getting this error:

Uncaught reference error:XMLHttprequest is not defined

Please help.

Sincere thanks.

Best Solution

I tried this it's simple mistake,

var request = new XMLHttpRequest();

dont use the simple letter for xmlHttpRequest. It should be a XMLHttpRequest. Also your simple r should be a capital R. it's work for me.Also try a different version of browser.