Click here to Skip to main content
15,910,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys

I am trying to get a method from a generic Handler File using JavaScript.
I get the error "Uncaught TypeError: DOM object constructor cannot be called as a function."

here is my function from .js file


JavaScript
var httpReq = null;
    httpReq = XMLHttpRequest();
    httpReq.onreadystatechange = XMLHttpRequest;
    httpReq.open("/_Property/PropertyGH.ashx?method=save");
    httpReq.send(null);
Posted
Updated 12-Sep-13 1:32am
v2
Comments
ZurdoDev 12-Sep-13 7:33am    
Which line of code causes it?
Anele Ngqandu 12-Sep-13 7:34am    
httpReq = XMLHttpRequest();
ZurdoDev 12-Sep-13 7:41am    
I believe solution 1 has the answer.
Anele Ngqandu 12-Sep-13 7:45am    
correct!!!

1 solution

Hello,

Are you missing "new"

Quote:
var httpReq = new XMLHttpRequest();


Valery.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900