Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:46:13+00:00 2026-06-17T06:46:13+00:00

I have a server side file that returns this data { success: true, m_sName:’smith,

  • 0

I have a server side file that returns this data

{
success: true,
m_sName:'smith, james',
m_ShortName:'Jim_S',
m_FirstName:'james',
m_LastName:'smith',
m_Rank:'CONT',
m_Unit:'',
m_Address:'PO Box 241',
m_City:'guthrie',
m_State:'KY',
m_Zip:'42234',
m_Phone:'270-956-3174',
m_Fax:'',
m_Email:'krullwarking@yahoo.com',
m_Title:'',
m_RegnetName:'james.andrew.smith',
m_BirthMonth:'10',
m_UserID:105745,
m_Age:47
}

Then on the client I have code that looks like this:

var Person = {
//Private members

getXmlRequestObj : function() {
        if (window.XMLHttpRequest) {
            importHTML2: new XMLHttpRequest();
        } else if(window.ActiveXObject) {
            importHTML2: new ActiveXObject("Microsoft.XMLHTTP");
        } else {
            importHTML2: "Your Browser needs an upgrade";
        }
    },


//Set up the global content retrieval object
//called importHTML
importHTML:  new ActiveXObject("Microsoft.XMLHTTP"),



getAjaxData:function(sUrl) {
    if (Person.importHTML.readyState == 4 || Person.importHTML.readyState == 0) {
        Person.importHTML.open("GET", sUrl, false);// make it wait for the response
        Person.importHTML.onreadystatechange = Person.handleDataArrived; 
        Person.importHTML.send(null);
    }       
},

//Called when the AJAX response is returned from any operation
//that lists handleContentArrived as its onreadystatechanged event
//for importHTML eg:importHTML.onreadystatechange = handleContentArrived; .
handleDataArrived: function() {
    if (Person.importHTML.readyState == 4) {
        Person._bar = eval("("+Person.importHTML.responseText+")");
        Person._sName = Person._bar.m_sName;
        Person._ShortName = Person._bar.m_ShortName;
        Person._firstName = Person._bar.m_FirstName;
        Person._lastName = Person._bar.m_LastName;
        Person._Unit = Person._bar.m_Unit;
        Person._securityGroups = Person._bar.m_Rank;
        Person._height = '6.0 ft';
        Person._weight = '280lbs';
        Person._hairColor = 'Brown/gray';
        Person._photoURL = 'www.photourl.com';
        Person._facebookID = 'Krullwarking@yahoo.com';
        Person._emailAddress = Person._bar.m_Email;
        Person._phoneNumber = Person._bar.m_Phone;
        Person._Fax = Person._bar.m_Fax;
        Person._NetworkName = Person._bar.m_RegnetName;
        Person._ID = Person._bar.m_UserID;
        Person._Address = Person._bar.m_Address;
        Person._City = Person._bar.m_City;
        Person._State = Person._bar.m_State;
        Person._Zip = Person._bar.m_Zip;
        Person._Title = Person._bar.m_Title;
    }
},
wholeName : function()
    {
    return this._firstName + ', ' + this._lastName; 
    },

// constructor
loadPerson : function(ID){
    Person._ID = ID;
    Person.getAjaxData('getUser.asp?uid='+ID);
},


setFirstName : function(fname) {
    Person._firstName = fname;
    return true;
},
// add the methods to the prototype so that all of the 
// Foo instances can access the private static
getFirstName : function() {
    return Person._firstName;
}
}
Student = {

superClass:Person,
sayHello : function(){  alert('hi, I am a student, and my name is '+this.superClass.wholeName());} 
}
Student.superClass.loadPerson(105745);
Student.sayHello();

This works fine but only in IE because of the activex reference to xmlHTTP. everytime I try to make the importHTML variable call the this.getXmlRequestObj or Person.getXmlRequestObj it doesnt work…..How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:46:14+00:00Added an answer on June 17, 2026 at 6:46 am

    Your problem is that you never use getXmlRequestObj. I’m guessing you first tried to do something like

    ...
    innerHTML: Person.getXmlRequestObj(),
    ...
    

    But that doesn’t work, because you can’t refer to an object’s properties in the object’s own object literal definition. Instead, you can create a one-time initialization function that sets up importHTML, which you call immediately after the object definition.

    var Person = {
        ...
        initialize: function() {
            Person.importHTML = Person.getXmlRequestObj();
        }
        ...
    }
    Person.initialize();
    

    EDIT:

    Your JSON does not have quoted keys. JavaScript is perfectly happy to have objects like this:

    {
        foo: "bar"
    }
    

    but the JSON specification is more strict. It requires object keys to be quoted, like so:

    {
        "foo": "bar"
    }
    

    eval executes JavaScript, so it accepts the looser syntax. JSON.parse and most other JSON utilities will only accept the strict syntax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Struts2 action in the server side for file downloading. <action name=download
I'm working within a platform that I do not have server side access to
I have a chrome extension which have a server-side javascript and I need this
If I have pages having server-side code in code-behind, then I know that the
The principle of sessions is to save data on server side that can be
I have Django project on Dreamhost server which has several views that returns Json
I have my server side code create an event on Facebook, using a Facebook
I have a server-side code using .NET Remoting to establish the connection with client.
I have an expensive server side resource ( which is thread safe ). What
What tools for server side application performance testing you suggest? Have an application server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.