user636525
user636525

Reputation: 3200

Async Controllers or Ajax?

I am writing an Asp.Net MVC 4 app, in which, once the user logs in, they are redirected to a dashboard page where i have these 4 seperate divs on that page. 4 different database calls have to be made to fill in these divs. I was planning to use multiple Ajax calls so that the user doesnt have to wait until all the data come back , to see the page. Then I read about async controllers and now i am confused whether to use async controllers or ajax calls for my purpose. please help ! Thanks in advance !

Upvotes: 1

Views: 645

Answers (2)

theSpyCry
theSpyCry

Reputation: 12283

Then I read about async controllers and now i am confused whether to use async controllers or ajax calls for my purpose

Just not to mix apples with pears.

You make an asynchronous controller to spawn another thread on the server, the client does not know anything about it. (to avoid thread starvation on server, it makes sense for long time operations - like binary operations etc.)

You make an asynchronous request just not the block the UI thread of the Browser on the client.

Upvotes: 0

John Gwynn
John Gwynn

Reputation: 54

Asynch controllers, to my mind, allow for more responsive request processing on the server by allowing it to handle mre concurrent requests in a non-blocking fashion similar to node.js. Ajax is, as noted, asychronous by default on the client/browser and this is what you need to allow the page to render without blocking.

Upvotes: 1

Related Questions