Avatar of warba
Flag for Canada asked on

Unknown name. error - trying to understand AJAX problem

We have a page that today stopped working. It has a textbox that, when you tab off of it, makes an async call to get data to populate some other controls on the page.

The error when you tab off the field is:
Line: 522
Char: 5
Error: Unknown name.
Code: 0

The line of code causing the error is on the httpReq.open line...

            function txtUserID_Change(_sEntity, sLoggedInUsr)
                  _Entity = _sEntity;
                  //get user id
                  var otxtUserID = window.document.getElementById("WebPanel2_ItemComposite_HeaderDataItems1_txtUserId");
                  var stxtUserId = otxtUserID.value;
                  if(stxtUserId != "")
                        httpReq =  new ActiveXObject("Microsoft.XMLHTTP");
                        httpReq.onreadystatechange = UserReadyStateEvent;
                        httpReq.open("GET", "https://" + _WebServer + "/" + _WebApp + "/Pages/AsyncWebForm.aspx?Op=UserInfo&InputValue=" + stxtUserId + ";" + sLoggedInUsr , true);

If I comment out the httpReq.open line then there is no error (but of course no data either).
I've used an alert box to show the URL being requested, and I can copy/paste this into my IE browser and it functions and returns a small XML document. I've tried this on the webserver itself (the page being requested is on the same website as the page with this javascript.. it is not trying to access another server or anything like that).

This has been working for a year and suddenly stopped in the middle of the day yesterday.

Where should I look?

Avatar of undefined
Last Comment

8/22/2022 - Mon

Which version of IE are you testing?
In IE 7 there is no ActiveX support.

Even if IE is the older version you should make this check:

if (window.XMLHttpRequest){
      httpReq = new XMLHttpRequest()
}else if (window.ActiveXObject){

      try {
            httpReq = new ActiveXObject("Msxml2.XMLHTTP")
      }catch (e){
                  httpReq = new ActiveXObject("Microsoft.XMLHTTP")
            }catch (e){

} else{
      return false

Try it out


We use IE6.
But as I mentioned, all was working at 2 pm, and at 2:10 pm we started getting the error.
The code worked before and hasn't been changed.

Unknown name makes me think about web server changes in the realm access control lists, or even changing the realm. Does your address in browser ask ever for userid and password? Do you have successfull access as browser window address and afterwards that name error in SAME browser window?

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

I have fixed the problem, but don't understand what has happened (points still available for an explanation)...

The URL being requested was https://.....
I changed it to http://.... and it works.

But, if I put the https://... url in my browser it works fine.

So, how it is that using JavaScript with httpReq.open("GET", "https://...",true) does NOT work; but yet I can type the same URL into my browser and it DOES work?

Should .js code running in a VM in the brower not have the same access settings as the browser itself ?
..and if not, then how could this change ?

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

I added a valid username and password to the .open() and still get "Unknown name." with https.

Sorry, I am now out of ideas.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.