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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:39:45+00:00 2026-06-10T01:39:45+00:00

The settings on the object window, only get "fixed" if I call the function[ctrUpadateCount]

  • 0

The settings on the object window, only get "fixed" if I call the function[ctrUpadateCount] under an alert, if I do a direct call it wont work.
Any idea why? I had the same issue on another project. And had to apply a solution which cannot be applied here.
I’ve tried to explain the code bellow…
p.s.: sorry for bad English.

function ctrUpdateCount(idCtrForm)
{     
   $.ajaxSetup({ assync: false});
   tableName= 'clients';
   p_comando="select count(*) total from "+tableName;
   $.post("execute.php", {comando : p_comando}, function(json){           
    v_total=json[1].total ; // <= this retuns 3
    window['ctrBuffer_'+idCtrForm].count=v_total;
    alert("count inside = "+ window['ctrBuffer_'+idCtrForm].count );//this alerts 3
   },'json'); 
}

jQuery.fn.extend( { ctrLoad: function()
   { 
    if( $(this).get(0).tagName =='FORM'){       
     idCtrForm=$(this).attr('id');
     alert("direct count ="+ctrUpdateCount(idCtrForm) ); // this will alert 3
                                                         // and so  the next alert
     //teste=ctrUpdateCount(idCtrForm); // but if I use this, 
                                        //the next alert will show  "undefined"
     alert("count after = "+ window['ctrBuffer_'+idCtrForm].count );
    }
  } 
})
  • 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-10T01:39:46+00:00Added an answer on June 10, 2026 at 1:39 am

    Your “ctrUpdateCount” function is using $.post(), which is asynchronous. It’s impossible to have the function return a value determined by the result of that asynchronous operation; it’s inherently nonsensical.

    I really can’t tell what you’re trying to do, but basically you have to do what you need to do with the results of the “POST” operation inside the callback function to $.post().

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

Sidebar

Related Questions

I've got a settings object for my app that has two collections in it.
I've been storing collections of user settings in the Properties.Settings.Default object and using the
I'm using a public static object to handle user settings. The first view reads
void TheSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var settings = IsolatedStorageSettings.ApplicationSettings[StorageSettings] as Dictionary<string, string>; settings[e.PropertyName]=
Is there a way to get the address of an object? This is for
I am trying to modify the System.Drawing.Printing.PrinterSettings object that I get from the System.Windows.Forms.PrintDialog
In my senario, I have a global setting object, say GlobalSettings, it has a
What is the best way to store settings for certain objects in my database?
I'm having issues setting the delegate of a Core Data object to a certain
I am having a problem when setting VB.NET list object to another. In the

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.