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 8504847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:09:02+00:00 2026-06-11T02:09:02+00:00

I created a class in ExtJs including variables and function that modifies internal properties

  • 0

I created a class in ExtJs including variables and function that modifies internal properties to the class.

My problem is focused when I want to change internal properties of the class (from internal or externals functions of class).

The class:

var Ws = new Ext.Class({
    WsUrl: '',
    WsErrorCode: 0,
    WsOut: null,
    CoreVersion: '',
    AppName: '',
    AppVersion: '',
    BrowserLanguage: GetBrowserLanguage(),
    BrowserUserAgent: GetBrowserLanguage(),
    BrowserToken: '',

    constructor: function(url) {
        this.WsUrl = url;

        return this;
    },

    SendCmd: function(CmdName) {

    var WsOut;
    var WsErrorCode;

        //Send request
        Ext.Ajax.request({
            loadMask: true,
            url: this.WsUrl,
            params: {cmd: CmdName},
            success: function(response, opts) {

                WsOut = Ext.decode(response.responseText);
                WsErrorCode = response.status;    
            },
            failure: function(response, opts) {

                WsOut = Ext.decode(response.responseText);
                WsErrorCode = response.status;    
            }
        });


        this.WsOut = WsOut;
        this.WsErrorCode = WsErrorCode;

        return this;
    }
});

Here the object is created:

var WsTest = new Ws('ws.php');
WsTest = WsTest.SendCmd('GetBrowserToken');


alert(WsTest.WsErrorCode);  //Here, the code must return 200 but the value is 0 ... why ?

Do you have an idea of ​​why This.WsOut = WsOut does not set the property correctly ?

  • 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-11T02:09:03+00:00Added an answer on June 11, 2026 at 2:09 am

    your issue is that the request is asyncronous. So by the time you assign wsOut, the request is still in progress.
    Add the scope to the request and set the internal attribute on the callback functions.

     Ext.Ajax.request({
                loadMask: true,
                url: this.WsUrl,
                scope:this,
                params: {cmd: CmdName},
                success: function(response, opts) {
    
                    this.WsOut = Ext.decode(response.responseText);
                    WsErrorCode = response.status;    
                },
                failure: function(response, opts) {
    
                    this.WsOut = Ext.decode(response.responseText);
                    WsErrorCode = response.status;    
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to fire event in custom class written in Extjs 4. I created
I created class inherited from DataTable. I want to Expose the items like Name
I have the following dynamically created class that is passed into the xpath function
I've created class that takes Exception type in constructor private readonly Exception _exception; public
I created a class with properties like this public class Dependencies { public string
I created a class that extends DefaultMutableTreeNode. It has a variable, resource of the
I created a class that's something like this: public class MovieTheaterList { public DateTime
I created a class CMyClass whose CTor takes a UCHAR as argument. That argument
I created a class that handles serial port asynchronously. I use it to communicate
I want to use unobtrusive validation on my MVC app. I've created class [AttributeUsage(AttributeTargets.Property,

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.