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

The Archive Base Latest Questions

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

I am new with jQuery and I’m having a hard time getting my page

  • 0

I am new with jQuery and I’m having a hard time getting my page to continually update as results come in from my java servlet. I want like a timer effect on the web page as new time values are coming in from the servlet.

On my webpage I have something like this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script> 
<script>$(document).ready(function(){$.get("/timer", function(data){$('H1').append(data);  })})(); </script>

And in my servlet timer I have a while loop that uses the response.getWriter() to write the new time value for like 30 iterations:

//this is in my doGet function
while(count <30 ){
count++;
out.println(count);
}

The problem is when I load the page nothing gets appended to the page until the 30 iterations are done. Is there a way to get each it iteration print out to show on the page?

Thanks

  • 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-01T07:15:16+00:00Added an answer on June 1, 2026 at 7:15 am

    out.flush() will write whatever is in the buffer to the browser.

    Remember though that if you have a long running server operation, you may need a better mechanism so that the server knows when client goes away/stops the operation so that server can stop the processing too. Also, you can have a better user experience by not needing to navigate to another page, by leveraging javascript

    Typically, a javascript timer/poll is used to obtain status of the operation (on the server, you may have the operation running on a separate thread – this also serves as a keep-alive message to the server – if the server does not receive a alive, it may want to stop the processing for efficiency )

    Long polling and html5 web socket (you will need support on the server for web socket) are other approaches –

    see:
    http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery

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

Sidebar

Related Questions

I'm having trouble getting tinyMCE to work with the new jQuery 1.4.2 on IE6.
Am new to jquery. Have json response from php in this format. { div1:{data:minute=0,hour=27,day=649,month=19K,smallSize=0,
New to Jquery and I think most of my troubles are from assumptions based
i m adding new jquery ui tabs to a tab the sample page (click
I am having trouble learning to use the new jQuery Deferred. The does an
I am a new jquery/js user trying to pass an argument from a selector
I am programming a new jquery-ui widget from scratch. I found the official 'how
When writing a new jQuery plugin is there a straightforward way of checking that
Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to
I've been trying to use the new jquery-ui, and all but the resizable function

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.