Tuesday, September 1, 2009

JQuery AJAX with ASP.Net MVC

Introduction

The JQuery has following methods that can be used to perform Ajax requests:

  1. ajax() - Load a remote page using an HTTP request. This is jQuery's low-level AJAX implementation.
  2. load() - Load HTML from a remote file and inject it into the DOM.
  3. get() - Load a remote page using an HTTP GET request.
  4. getJSON() - Load JSON data using an HTTP GET request.
  5. getScript() - Loads, and executes, a local JavaScript file using an HTTP GET request.
  6. post() - Loads HTML by performing an HTTP post request.

Background

In this article, I will show you how to build a Jquery AJAX enabled ASP.NET MVC application. To create a new MVC project, see ASP.net MVC application structure. I will consume a USA Weather Forecast web service which is freely available at WebserviceX.NET

Using the code

To reference the Jquery AJAX script libraries, add the following markup at the end of the head element in Site.Master:


See full detail: http://www.codeproject.com/KB/ajax/JQuery-AJAX-with-ASP-Net.aspx