Link to home
Start Free TrialLog in
Avatar of warba
warbaFlag 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 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;
              "GET", "https://" + _WebServer + "/" + _WebApp + "/Pages/AsyncWebForm.aspx?Op=UserInfo&InputValue=" + stxtUserId + ";" + sLoggedInUsr , true);

If I comment out the 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 gops1
Flag of United States of America image

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

Avatar of warba


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.
Avatar of Zvonko
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?

Avatar of warba


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"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 ?
Avatar of Zvonko
Flag of North Macedonia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of warba


I added a valid username and password to the .open() and still get "Unknown name." with https.
Sorry, I am now out of ideas.