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

  • SEARCH
  • Home
  • 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 6683803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:51:52+00:00 2026-05-26T04:51:52+00:00

I cannot access my JSON object properties. Given this constructor contractorTestQuestion = function (id,

  • 0

I cannot access my JSON object properties. Given this constructor

contractorTestQuestion = function (id, question, multianswer, textanswer, order) {
    var cntrQuestion;
    this.initialize(id, question, multianswer, textanswer, order);
}

$.extend(contractorTestQuestion.prototype, {
    initialize: function (_i, _q, _m, _t, _o) {
          cntrQuestion = {
            "questid" : _i,
            "question": _q,
            "multianswer": _m,
            "textanswer": _t,
            "order": _o,
            "answers": [],
            "change": 'none'
        }
    },
    addAnswer: function (a) {
        answers.push(a);
    },
    getAnswer: function (idx) {
        return this.answers[idx];
    }
});

I then create it in my code like this:
var cq = new contractorTestQuestion(qid, q, m, t, tqQuesPos);

what I want to do is cq.question and be able to get the value stored in that field.

I cannot figure out what I’m doing wrong

  • 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-05-26T04:51:53+00:00Added an answer on May 26, 2026 at 4:51 am

    You cannot just set the properties of contractorTestQuestion by adding it to a private variable.

    Set the properties on this like:

    initialize: function (_i, _q, _m, _t, _o) {
        this.questid = _i;
        this.question = _q;
        this.multianswer = _m;
        this.textanswer = _t;
        this.order = _o;
        this.answers = [];
        this.change = 'none';
    },
    

    Also, this has nothing to do with JSON which is a data format.

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

Sidebar

Related Questions

It seems that i cannot access $(this) inside jquery ajax success function. please see
I changed the tree of my JSON-P output, and i cannot access to my
I cannot seem to access the context object using a loop context is set:
I'm newbie with JQuery. I got this function function verify_at_bd() { var u =
A Google APIs encoded in JSON returned an object such as this [updated] =>
This may be more of a scoping question. I'm trying to set a JSON
I cannot access the context attribute of an HttpResponse object from ipython. But the
I have the following object: //the constructor function function NewsScroller() { } //now put
Possible Duplicate: How do I access this object property? The data returned in a
Inside an OnClickListener I cannot access most variables outside of the scope, like this:

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.