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

  • Home
  • SEARCH
  • 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 3353198
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:07:20+00:00 2026-05-18T02:07:20+00:00

I was wondering what’s the best format for the data that gets sent back

  • 0

I was wondering what’s the best “format” for the data that gets sent back to the javascript to be in?
When should I use a JSON string or just plain HTML? Are there any other options besides these two?

  • 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-18T02:07:21+00:00Added an answer on May 18, 2026 at 2:07 am

    It depends on what the data being sent back is and how you plan to use it.

    Pros and Cons:

    • Using json data and HTML generation JavaScript puts more load on the browser and less load on a server, plus no need to code presentation logic into the page which serves the data. And JSON data is usually much smaller.

    • Using HTML data and injecting straight into the page puts more work on the server, causes the AJAX-serving page to contain presentation logic. However, if the presentation logic is already contained in your server side code (directly or via templating language) and placing said presentation logic into JavaScript side would necessitate you to develop it from scratch, it may be a benefit instead of the downside.

    In other words, use JSON data iff:

    • Your page will use that JSON data for purposes other than one-time generation of HTML. DUH.

    • Your page already contains JavaScript logic to build the HTML based on the data, or if creating such logic is very easy development cost. Especially if the opposite is true (e.g. putting the HTML generation logic server-side needs to be done and presents significant development cost).

    • Off-loading resource cost of converting the data into HTML from the server onto the browser is an important consideration.

    • JSON data is significantly smaller than the produced HTML, thus resulting in a MAJOR reduction of transmitted data. This speeds up both the server execution, AND the network transmission. We actually had like 20x speedup of a complex tree-displaying app by transmitting tree data as json instead of already-generated HTML code.

    • The URL producing the response can be re-used as a service for purposes OTHER than this one page, if the other possible/actual consumers would not be able to 100% re-use the HTML generated for this specific page.

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

Sidebar

Related Questions

Wondering how to open many new windows with Javascript. I have found plenty of
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview
Just wondering if a .NET app can be compiled down to native machine code
Just wondering if there is an easy way to add the functionality to duplicate
wondering about the best way to approach this particular problem and if any libraries
Wondering if I could get some advice on tokenizing a string in php since
Wondering if anyone has gotten the infamous database is locked error from Trac and
Wondering if there is any Text to Speech software available as a plug in
Wondering if I need to do something in my swf to be able to
Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality.

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.