dtakis
dtakis

Reputation: 581

Best C# Ajax (with jquery) HTML display programming pattern/usage in asp.net

In C# programming i usually do the following: For json response i call an .asmx or .ashx file with jquery and parse the repsonse.

For html response which is better in programming ease and improvements later? Call a .aspx file as i already do or is there any other way?

I don't like the idea of .ashx because the data can not be seen in Designer mode.

all i want is something like this in client side:

$.ajax({
      type: "POST",
      url: "something",
      cache: false,
      success: function(msg) {
        // Replace the div's content with the page method's return.
        $("#container").html(msg);
      }
    });

Upvotes: 0

Views: 246

Answers (1)

Cybermaxs
Cybermaxs

Reputation: 24558

The standard is now to provide data (json/html) by a RestService with WCF or the new asp.net WebApi. After, you will use a javascript micro templating framework for client rendering.

Just for ajax calls, It is not "always" a good approach to render content (html) in the server side.

Here is a great link. Event if it not aspnet specific, it is the same.

Upvotes: 1

Related Questions