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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:38:20+00:00 2026-06-01T03:38:20+00:00

I have a REST api which dumps some json data (user info, etc). Now

  • 0

I have a REST api which dumps some json data (user info, etc). Now I need to use that data to:

  1. construct html tables,
  2. plat graphs using some js graphing lib,
  3. Do some calculations over some fields and again display them.

So, essentially I need to do some processing on that data and then display the refined form.

I am new to javascript and trying to understand what is the best practice to construct the html?

I am using jquery to make the ajax call and the success part looks something like this:

success:function(data){
  $('#show_data_here').empty();
  generated_html  = construct_html(data);
  $('#show_data_here').html(generated_html);
}

Now, the construct_html(data) function is getting really ugly since the json I am receiving is huge (800 lines) and I have alot (~10) graphs to display on one page. Is there a better way to approach this problem?

  • 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-01T03:38:21+00:00Added an answer on June 1, 2026 at 3:38 am

    as a start try breaking them down into functions that perform each task.
    Then within each task, you may have sub-tasks. break them down again.

    success:function(data){
      constructTable(data.tableData);
      grabLib.create(data.graphData);
      updateCalculations(data.tableData);
    }
    
    function constructTable(data)
    {
      var html = '';
      // foreach
      $('table tbody').empty().html(html);
    }
    
    // etc
    

    Idealy you would want to be dealing with objects that could perform the tasks for you, but your first steps would be breaking down the functionality. into smaller chunks.

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

Sidebar

Related Questions

We have a REST API which clients routinely POST and PUT data to. When
I have a REST-ish API that returns JSON. One of the output fields is
I have been given some basic documentation of the RazorGator REST API and need
I have a REST API which is fairly typical, except that the id's of
I have a scenario in which I have REST API which manages a Resource
We are trying to implement a REST API for an application we have now.
I'm developing a REST api. To simplify my question, I have an API that
I have a REST webservice that I need to consume in C#. I need
I have a REST API which accepts XML in HTTP Posts. When I send
We have a REST API that works great. We're refactoring and deciding how to

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.