The ASP.NET MVC RC includes a number of AJAX enhancements:
jQuery Intellisense Files included within ASP.NET MVC
Project Template
Newly created ASP.NET MVC projects now include both the
standard jQuery library (both full and compressed versions), as well as the
–vsdoc intellisense documentation file used by Visual Studio to provide richer
intellisense support for it (you can learn more about this here):
Figure 43
This enables rich jQuery JavaScript intellisense within
client-script blocks and JavaScript files:
Figure 44
Today’s RC build ships jQuery 1.2.6. We are planning
to ship the upcoming jQuery 1.3.1 release for the final ASP.NET MVC 1.0
release, and will include an updated JavaScript intellisense file for it.
Request.IsAjaxRequest Property
The Request.IsAjaxRequest property can be used to detect
whether a request is being sent from an AJAX call on the client (and is useful
for scenarios where you want to gracefully degrade if AJAX is not
enabled). The logic within this method was updated with the RC to now
recognize the “X-Requested-With” HTTP header (in addition to the form field
sent by ASP.NET AJAX). This is a well known header sent by JavaScript
libraries such a Prototype, jQuery, and Dojo – and now enables a unified way to
check for AJAX within an ASP.NET MVC request.
JavaScriptResult ActionResult and JavaScript() helper
method
The Controller base class now has a JavaScript() helper
method that returns a new ActionResult class of type JavaScriptResult.
This supports the ability to return raw JavaScript that will then be executed
on the client by the built-in ASP.NET MVC helper methods. This can be
useful for scenarios where you want to cause conditional JavaScript to execute
on the client based on server logic.