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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:47:52+00:00 2026-05-30T11:47:52+00:00

We’re currently not using any serious client side framework besides jQuery (and jQuery.ui +

  • 0

We’re currently not using any serious client side framework besides jQuery (and jQuery.ui + validation + form wizard plugins).

A problem that surfaces a few times in our code is this:

  1. We have a button that initiates an Ajax call to the server.
  2. While the call is taking place, we display a “loading” icon with some text
  3. If the server returns a result too quickly (e.g. < 200 ms), we “sleep” for 200 millis (using setTimeout()), to prevent flickering of the waiting icon & text.
  4. After max(the call returns, a minimal timeout), we clear the loading icon & text.
  5. We then either display an error text, if there was some problem in the ajax call (the server doesn’t return 500, but a custom json that has an “error message” property. In fact, sometimes we have such a property in the response per form field … and we then match errors to form fields … but I digress).
  6. In case of success, we do … something (depends on the situation).

I’m trying to minimize code reuse, and either write or reuse a pattern / piece of code / framework that does this. While I probably won’t start using an entire new heavy-duty framework just for this use case, I would still like to know what my options are … perhaps such a client-side framework would be good for other things as well. If there’s a lightweight framework that doesn’t require me to turn all my code upside down, and I could use just on specific cases, then we might actually use it instead of reinventing the wheel.

I just recently heard about Ember.js – is it a good fit for solving this problem? How would you solve it?

  • 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-30T11:47:53+00:00Added an answer on May 30, 2026 at 11:47 am
    $(function(){
     var buttonSelector = "#button";
     $('body').on({'click': function(evt){
        var $button = $(this);
        $button.toggleClass('loading');
        var time = new Date();
        $.get('some/ajax').then(function(data,text,jqXhr){
       // typical guess at load work
           $button.empty();
           $(data).wrap($button);
        }).fail(function(data,text,jqXhr){
         alert("failed");
        }).done(function(data,text,jqXhr){
           var elapsed = new Date();
          if((elapsed - time) < 200){
            alert("to short, wait");
          }
          $button.toggleClass('loading');
        });
      }},buttonSelector,null);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.