Return HTML or JSON for a readonly table in ASP.Net MVC?

If you have a read-only table that will be updated via ajax, is it better to have the markup generated on the server or just return the JSON and render the table on the client?

They're both fairly simple to do, so I'm wondering which is preferable assuming the table markup is relatively simple.

At 1st I thought returning JSON might be faster, but I'm not sure. It seems like the bandwidth would be similar, and I don't know how fast ASP.Net can return a collection as JSON vs rendering a partial view.

Has anyone done any benchmarks or have any opinions on which they think is preferable in this scenario?


I think you should be returning JSON and allowing the consuming client to apply the rendering to that JSON, that way if your offering needs to change for different consumers, they just take the same raw data and apply the specific formatting rules they need.

If the nature of page is static then I would recommend server side rendering. If you want interactive experience then use client side rendering.

Here is a good link comparing Client-Side vs. Server-Side Rendering

Need Your Help

Can POST and GET be combined within a single input type?

javascript php forms post get

I have a form running a shopping cart style application on my site. To add items, I POST values to a form using a submit button. To remove items, I have to use a GET command.

How to call Magento Api method in another api class?

api magento

I created one module in Magento. I create Api.php in that. Now I want to call one another api method in that. For example in my module I have 2 folder. Product and Shipping. Now I create one method...