Skip to Main Content
ASP.NET 4 24-Hour Trainer
book

ASP.NET 4 24-Hour Trainer

by Toi B. Wright
July 2010
Beginner content levelBeginner
552 pages
10h 14m
English
Wrox
Content preview from ASP.NET 4 24-Hour Trainer

Chapter 25B. Using jQuery for Ajax in MVC

In Lesson 23 you learned about using JavaScript to perform client-side programming. In that lesson you were introduced to the jQuery script library. In Lesson 24B you learned how to use the Ajax helpers provided by the ASP.NET MVC framework. In this lesson I teach you how to use the Ajax tools provided by jQuery.

AJAX METHODS

These are the Ajax methods that jQuery provides:

  • $.ajax — This method performs an Ajax request. All of the other methods in this list are shortcuts that use this method.

  • $.get — This method loads HTML using an HTTP GET request.

  • $.getJSON — This method loads JSON-encoded data using an HTTP GET request.

  • $.getScript — This method loads a JavaScript file using an HTTP GET request and executes it.

  • .load — This method loads HTML into the specified element.

  • $.post — This method loads HTML using an HTTP POST request.

    Note

    JSON stands for JavaScript Object Notation. It is a format used to represent simple data structures and objects in a lightweight, text-based, human-readable format.

The simplest way to fetch data asynchronously from the server is to use the .load method. These are the parameters of the .load method:

  • url — This is a string that contains the URL to which the request is sent. This is the only required parameter.

  • data — This is a string that contains any data that needs to be sent to the URL.

  • complete — This is the function that is called when the request completes.

The .load method uses a GET method to fetch data from the server, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 4 24-Hour Trainer

ASP.NET 4 24-Hour Trainer

Toi B. Wright
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9780470596913Purchase bookExamplesErrata