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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:27:41+00:00 2026-05-16T07:27:41+00:00

I am doing a jQuery $.get to a html file, and in the success

  • 0

I am doing a jQuery $.get to a html file, and in the success function I filter on a select block and take the options apart, rendering the text of the selects as paragraphs in divs that I append in my markup.
Getting and rendering the selects takes a while (there are about 8000) but I was expecting the div’s to show up one by one and letting me work on them (I assign click and hover events to them with .delegate …), but they show all up at once and my browser window is blocked.
I even explicitly set async: true with an $.ajaxSetup before the $.get (which should not be necessary as it’s the default).
I must be missing something fundamental but have no idea what …
Thanks in advance for ideas and tips.

  • 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-16T07:27:42+00:00Added an answer on May 16, 2026 at 7:27 am

    You should load the results in smaller chunks. In pseudocode it will be something like this:

    loadDataUsingAjax(url, index) {
      load the first index to index + 250 items async using an ajax call;
      if there are still more items
         a few mili seconds later call loadDataUsingAjax(url, index + 500);
    }
    
    loadDataUsingAjax(url, 0);
    

    Otherwise most browsers, especially on slower computers, will freeze for a few seconds while they try to update the DOM.

    UPDATE: Actual jQuery code

    var CHUNK_SIZE = 500;
    var DELAY = 100;
    
    function loadDataUsingAjax(ajaxUrl, index) {
      $.ajax({
        url: ajaxUrl,
        data: {startIndex: index, chunkSize: CHUNK_SIZE},
        dataType: 'json',
        success: function(response) {
          // response is in JSON format
          // convert it into HTML and add it to the appropriate location in the page
          // response.hasMoreResults indicates whether there are more items in the result set
          if (response.hasMoreResults) {
             setTimeout(function() {
                loadDataUsingAjax(ajaxUrl, index + CHUNK_SIZE);
             }, DELAY);
          }
        } 
      });
    }
    loadDataUsingAjax("yourUrl", 0);
    

    Your server side script should do something like this:

    startIndex = get the value of the startIndex request parameter;
    chunkSize = get the value of the chunkSize request parameter;
    // MySQL query
    select ... from ... where ... limit startIndex, startIndex + chunkSize;
    create a json result from the MySQL result set;
    select count(...) from ... where ...;
    if count(...) is > startIndex + chunkSize then set hasMoreElements = true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the principles of doing jQuery-style function chaining straight in my
I'm using the jQuery .get() function to load in a template file and then
HTML <a href=report.php?id=5&file=name.jpg id=5 class=report>Report Content<span class=hidden>name.jpg</span></a> jQuery $('.report').click(function(event) { var id = this.id;
I have the following snippet JQuery inside an HTML file: $.getJSON(/events/, function (data) {
I am using jQuery's load function to get template data from external html files.
Not sure what I'm doing wrong but I can't get my JQuery AJAX call
What am I doing wrong here? I'm trying to get started with jQuery UI
I'm doing a jQuery AJAX post like this: var form = $(#formid); form.submit(function() {
Here is my html form <div id=create> <form action=index.php method=get id=createform> <input type=text name=urlbox
I have a simple ajax call: $.ajax({url: my_url_here, dataType: 'text', success: function(data, textStatus) {

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.