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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:01:59+00:00 2026-05-15T13:01:59+00:00

I asked a fairly poor question yesterday, but I still have the same general

  • 0

I asked a fairly poor question yesterday, but I still have the same general problem. I wanted to add a variable property to an object, and the solution I attempted was to do an ajax request to receive the variable, and then set the property to the response. I think I have tried this at least 100 different ways:

Ext.onReady(go);

function go() {

  var x; 

  function getRating(id, callback) {
      Ext.Ajax.request({
          url: '/index.php/ajax/do_rate',
          method: 'POST',
          success: function(result)
          {
              jsonData = Ext.util.JSON.decode(result.responseText);
              x = jsonData.result;
          }
      });
  }
  r2 = new Ext.ux.form.Rater({
      displayValue: x,
      maxValue: 10
  });

  var simple = new Ext.FormPanel({
    items: [r2]
  });
  simple.render(document.body);
}

If it try it as above, x is undefined. If I try to create r2 prior to the ajax request, and set its displayValue within the request, the correct displayValue is shown for the object in the console, but it does not render with the correct displayValue. I don’t think it makes it in time. Thanks for the help, I’m thinking I might need a ‘callback’, but cannot figure out the proper method.

The working code is below:

Ext.onReady(go);

function go() {
    Ext.Ajax.request({
        url: '/index.php/ajax/do_rate',
        method: 'POST',
        success: function(result)
            {
            jsonData = Ext.util.JSON.decode(result.responseText);
            var r2 = new Ext.ux.form.Rater({
                displayValue: jsonData.result,
                maxValue: 10
            });
            var simple = new Ext.FormPanel({
                items: [r2]
            });
            simple.render(document.body);
        }
    });
}
  • 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-15T13:01:59+00:00Added an answer on May 15, 2026 at 1:01 pm

    Just do everything you need to do with the data inside the “success” callback.

    function go() {
    
      function getRating(id, callback) {
          Ext.Ajax.request({
              url: '/index.php/ajax/do_rate',
              method: 'POST',
              success: function(result)
              {
                  jsonData = Ext.util.JSON.decode(result.responseText);
    
                  var x = jsonData.result;
    
                  var r2 = new Ext.ux.form.Rater({
                      displayValue: x,
                      maxValue: 10
                  });
    
                  var simple = new Ext.FormPanel({
                    items: [r2]
                  });
                  simple.render(document.body);
              }
          });
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A fairly basic question, but I don't see it asked anywhere. Let's say we
(I asked this question in another way , and got some interesting responses but
I asked a somewhat related question but I want it to make it more
I asked this question before, Here however I think I presented the problem poorly,
Does anybody know? Couldn't find this question asked before, even though it seems fairly
I've been asked to create a fairly straightforward website for a friend. Essentially a
I asked before about pixel-pushing, and have now managed to get far enough to
Someone asked me a question via e-mail about integer partitions the other day (as
This is a fairly simple problem, I'm just not sure exactly how to approach
I asked this question (below) a week ago and got the answer I was

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.