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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:51:01+00:00 2026-05-12T09:51:01+00:00

I am engaged in a small debate with the server side developer for my

  • 0

I am engaged in a small debate with the server side developer for my project (I’m the front end guy) around injecting new stuff into DOM. He maintains that the best method to inject a large amount of code (received via ajax) is to send a JSON object and then to iterate through each item of that object. He says that will save some bandwidth and is more server friendly.

Obviously (for me, at least 🙂 ), this mean a LOT of cpu cycles on client.

The data is basically a table with 20-30 rows (2-3 cols each), which means few (useless) iterations.

On the other hand, I think that the best method is to send pure XHTML (server generated source) and just inject it in place. This means just one cpu cycle ($('selector').html(data) where data is the data received with AJAX, but also means a lot of bloated HTML code.

I use jQuery (but I think that is not too important).

So, what do you think, guys? 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-05-12T09:51:01+00:00Added an answer on May 12, 2026 at 9:51 am

    Even as at first I commonly send HTML to be inserted at specific places, now I tend to use JSON whenever I can, XML otherwise, mainly because I can modify a lot of places of the page, and act more dynamically with little information.

    Also, JSON has a smaller footprint than XML and is also usually better "human parseable". XMl’s biggest advantage is that it has been around for a long time and is the standard, so you have both the tools, and the knowledgeable workforce at hand for it. JSON, on the other hand is a little more obscure. Of course, any developer worth its paycheck will be able to learn it faster than I can write this. Just think about it:

    • it has javascript syntax and
    • its the same concept of XML.

    About just sending HTML Quirksmode says:

    If the HTML snippet contains forms, or if the receiving HTML element is a form, this method give horrific errors in Explorer.

    (…)

    I’m going to study JSON carefully and might switch to it for an unrestricted access application I have in mind. Nonetheless I feel that XML remains the best overall format for the time being, mainly because people are used to it.

    In addition, HTML snippets may become quite complicated (…) Thus the server side script that generates the HTML may become quite complicated.

    Furthermore, by sending just HTML you can just paste information, you won’t be getting information, you’d be getting snippets, so you couldn’t operate with it. Remember that the advantage of AJAX is to have dynamic pages, not pages that have some parts that update without reloading the full page. You can use it for that, and is OK, and a valid use, but you are under utilizing the potential.

    Even when inserting HTML could be faster than dom manipulation, I don’t think that its that much (besides the problems you could have with IE 6). This you should test and see if for your use, its really a bottle neck of performance.

    I tend to agree with the closing argument of the previous link.

    Although I’d love to be able to say that one of them is "the best", I think choosing the right format depends on the circumstances, and not on any theoretical musings.

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

Sidebar

Ask A Question

Stats

  • Questions 219k
  • Answers 219k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer SELECT id, CASE WHEN value = 'xyz' THEN 'Pending' ELSE… May 12, 2026 at 11:50 pm
  • Editorial Team
    Editorial Team added an answer Using an extension method works quite neatly, when using the… May 12, 2026 at 11:50 pm
  • Editorial Team
    Editorial Team added an answer Why not use a general regex that will match any… May 12, 2026 at 11:50 pm

Related Questions

max-width with a percent doesn't seem to work in either IE 8 or Firefox
I am engaged in developing a C++ mobile phone application on the Symbian platforms.
I have a T-SQL view with integer fields. I need a report on a
I'm engaged in a C# learning process and it is going well so far.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.