Strictly using static html files, jquery, ajax and json web services for a website?

845 views Asked by At

I've been using ASP.Net MVC for a while now and I've been thinking that this:

<% foreach(ItemRow in Items) { %> <div><%=ItemRow.Description%></div> <% } %>

Reminds me a little too much of ASP Classic and PHP. Yeah there are definite improvements but it still makes me cringe a little.

I've been thinking instead of writing nothing but static html and strictly using jQuery to gather JSON results from webservices and populate the page appropriately. Has anyone tried this approach? What was your experience?

2

There are 2 answers

4
Victor On BEST ANSWER

I have been finding myself doing this more and more. I find it quicker to do simple customer-centric apps. The only "issues" are security and session state management. But it is not a deal killer.

Depends on your view, but one of the positives we have found is that we can build the business and data layers, allow our front end developers to build their interface vision without many restrictions, and finally we can allow a less experienced developer do a lot more of wiring the jquery stuff. Which from a business perspective has a higher ROI as i can dedicate the higher end engineers and developers to do better use of their time.

1
Darin Dimitrov On

I agree that having the following:

<% foreach(ItemRow in Items) { %> <div><%=ItemRow.Description%></div> <% } %>

in your view might be ugly. That's why I editor/display templates. So the code looks like this:

<%= Html.DisplayFor(x => x.Items) %>

and in the corresponding display template:

<div><%: Model.Description %></div>

As far as your second question is concerned about using jQuery to gather JSON data from various webservices and build the UI, it is an approach that might work for simpler scenarios but IMHO for complex business applications you might want to consider ASP.NET MVC or even Silverlight.