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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:07:09+00:00 2026-06-07T18:07:09+00:00

I am doing a simple ajax call, and it is working fine. However, the

  • 0

I am doing a simple ajax call, and it is working fine. However, the response is slow, and I do not want the user to click twice thinking it is not working. Therefore, I would like to show a message such as “Converting please wait” before receiving the response. Here is the code that I have tried:

function postajax()
{
    document.getElementById('linksarea').innerHTML = "<img src='images/waiting.gif'> Converting please wait...";

    var xmlhttp;

    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
            document.getElementById("links").innerHTML=xmlhttp.responseText;
    }

    var links = window.document.getElementById('linksarea').value;

    xmlhttp.open("POST","ajax.php",true);
    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlhttp.send("links="+links+"&username=xxxx");
}

here is the html section thay i’m trying to modify

<div id="memberright">
  Convert the links here<br />
  <textarea name="links" id="linksarea" cols="65" rows="10"></textarea><br />
  <input type="button" id="buttonr" onclick="postajax()" value="Convert">
</div>

<div id="ajax">
  <div id="links">
  </div>
</div>
  • 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-07T18:07:10+00:00Added an answer on June 7, 2026 at 6:07 pm

    You are currently using:

    document.getElementById('linksarea').innerHTML = "<img src='images/waiting.gif'>
       Converting please wait..."; 
    

    which should set the innerHTML to the loading image and display a loading message. At a later point you are taking the value of that element:

    window.document.getElementById('linksarea').value;
    

    The value attribute will only exist on an input, which would not have innerHTML.

    Try the following, assuming #links is the element you’re wanting to modify, which according to your question’s title you are trying to change the value of a div element twice:

    document.getElementById("links").innerHTML = "<img src='images/waiting.gif'>
           Converting please wait..."; 
    
    // or if you have another div with an ID of `linksarea`
    
    document.getElementById("linksarea").innerHTML = "<img src='images/waiting.gif'>
           Converting please wait..."; 
    

    I could be completely wrong without seeing your HTML but that looks as though that could be your problem. You need to make sure you are trying to modify the correct element.

    Update:

    Using jQuery:

    function postajax(){
        $('#links').html("<img src='images/waiting.gif'> Converting please wait...");
    
        var params = "links=" + $('#linksarea').val() + "&username=xxxx";
    
        $.ajax({
            url: "ajax.php",
            type: "POST",
            data: params,
            success: function(result){
                $('#links').html(result)
            }
        }); 
    }
    

    As demonstrated, jQuery greatly simplifies executing AJAX requests with the $.ajax() function. I would suggest that you understand what is happening behind the scenes before utilizing a library so that you are able to fully understand verything. This will help encourage much more positive behavior and tendencies.

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

Sidebar

Related Questions

So i've been doing quite a simple ajax call to grab my photo albums
I have encountered a unique problem. I am doing a simple ajax call using
I am doing a simple ajax call with the YahooUI Javascript library as follows:
Im doing a simple ajax request like:` $.ajax({ type: 'POST', url: 'http://' + serverIP
I am doing a simple $.ajax request: $.ajax({ type: POST, url: /Run/ + param1
I'm doing a simple ajax query which retrieves a variable-length list of values as
I have a simple ajax call: $.ajax({ url: 'http://localhost:39657/List/Receptacle', dataType: json, success: function(json) {
I'm doing a jQuery Ajax call to a PHP script that returns this string
So I'm trying to do a simple AJAX call(my first try at it), to
I'm doing some simple tests (in preparation for a larger project) to call an

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.