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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:06:29+00:00 2026-06-01T04:06:29+00:00

I execute an ajax function that takes 3 seconds + so in this time

  • 0

I execute an ajax function that takes 3 seconds + so in this time I would like the text of the a link (code below, and 1 in image) to change to “Please wait…”. I tried the JavaScript code below but what happens is the text does not change and the function executes as normal. Please if someone could point out my mistake.

HTML :

<a id="emailGarageList" href="javascript:EmailGarageList(347)">Email Garage List...</a>

Screenshot :

enter image description here

Javascript :

function EmailGarageList(fId) {
    $('#emailGarageList').text('Please wait...');
    $.ajax({
        type: "POST",
        url: "Default.aspx/EmailGarageList",
        data: "{'fId':" + fId + ",'userId':" + userId + "}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            alert("Garage List Emailed!");
        },
        error: function () {
            alert("Error :(");
        }
    });
    $('#emailGarageList').text('Email Garage List...');
};
  • 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-01T04:06:30+00:00Added an answer on June 1, 2026 at 4:06 am

    Move $('#emailGarageList').text('Email Garage List...'); inside $.ajax call back function. $.ajax is an async call and your text below is updated right away before completing the ajax call.

    function EmailGarageList(fId) {
        $('#emailGarageList').text('Please wait...');
        $.ajax({
            type: "POST",
            url: "Default.aspx/EmailGarageList",
            data: "{'fId':" + fId + ",'userId':" + userId + "}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                alert("Garage List Emailed!");
                $('#emailGarageList').text('Email Garage List...');
            },
            error: function () {
                alert("Error :(");
            }
        });    
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an ajax function that i would like carry out on click of
I want to execute this script (view source) that uses Google Translate AJAX API
I wish to execute a javascript function after asp.net postback with out using ajax.
With this code: var db = google.gears.factory.create('beta.database'); db.open('cominar'); db.execute('CREATE TABLE IF NOT EXISTS Ajax
If I use Ajax to send request and this request take long time .....
I've been trying to troubleshoot this, but can't find a good function that will
I have a Jquery autocomplete ajax function whose source is calculated from code behind.
I can't seem to execute any code from an AJAX call or utilize the
I have a javascript function that has been driving me nuts. This is the
I have a JS function that does a ajax GET (datatype: JSON) to a

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.