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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:06:27+00:00 2026-06-18T05:06:27+00:00

In js (jquery 1.7) I use this code: When clicking on button two actions

  • 0

In js (jquery 1.7) I use this code: When clicking on button two actions are supposed to happen: 1. show status (show html) 2. run function to generate pdf

$( "#create_box" ).on("click", "#make_pdf_btn",function(){
$('.pdf_status0').html('Generating report...' );  // problematic line
 make_pdf2();
 return false;
  });

then:

function make_pdf2(){
    $.ajax({
            type: "GET",
            url: "make_pdf.php",   // pdf is created and saved
            async: false,          // synchronous  ajax
            success: function(html){ strReturn = html; }
    });

   if ( strReturn == 'pdfok' ){ 
        $('.pdf_status0').html('Done!<br>');
        $('.pdf_status').show();
       } else {
         $('.pdf_status').html('Error creating pdf.' );  
       }
  return false;      

}

Problem is that line $(‘.pdf_status0’).html(‘Generating report…’ ); is running ok in firefox and text ‘Generating report …’ is shown in div, then it is replaced with ‘Done!’.
However Chrome and IE8 don’t show ‘Generating report..’ only ‘Done!’ and pdf is created.

if i use alert(‘text’) instead of jquery html it is run and alert is shown in ie, chrome and firefox

  • 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-18T05:06:28+00:00Added an answer on June 18, 2026 at 5:06 am

    When you do a synchronous ajax call it usually locks up the browser until the response is processed, which means the screen isn’t repainted to show your “Generating report…” message until after it’s too late because you’ve already changed it to “Done!”.

    There’s almost never a good reason to use synchronous ajax, and I can’t see anything in your code that can’t be easily refactored to be asynchronous – which gives the browser a chance to repaint while the ajax call is in progress:

    function make_pdf2(){
        $.ajax({
                type: "GET",
                url: "make_pdf.php",   // pdf is created and saved
                async: true,          // use Asynchronous  ajax
                success: function(html){
                   // do all required processing on response in the success callback
                   strReturn = html;
                   if ( strReturn == 'pdfok' ){ 
                      $('.pdf_status0').html('Done!<br>');
                      $('.pdf_status').show();
                   } else {
                      $('.pdf_status').html('Error creating pdf.' );  
                  }
               }
        });
    
      return false;      
    }
    

    Having said that, I’ve occasionally that found older IE (not sure about IE8) still gets a bit confused in a way that can be fixed with a setTimeout() hack:

    setTimeout(make_pdf2, 4); // make call to make_pdf2() async too
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code: http://blogswizards.com/plugin-development/sliding-boxes-and-captions-with-jquery On a simple gallery site I am building. Specifically
I need help to use jConfirm with this existing code (php & Jquery &
I use this script: $(document).ready(function() { $page = jQuery.url.attr(file); alert(page); }); but I get
I use this tab view that developed base on jQuery: https://d2o0t5hpnwv4c1.cloudfront.net/001_Tabbed/site/jQuery.html# I change the
I generally use this in jquery $(document).ready(function() { //stuff } I was just on
I include a snippet of my project. When I run this code clicking add
I use jQuery to simulate the HTML5 placeholder function: // placeholder code $(function() {
Good day! For this example of function html() http://api.jquery.com/html/ How to return to link
In the code below I use the jQuery ajax() function to do a longpolling
I want to use this jquery library for my web page. I am copying

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.