O'Reilly logo

ASP.NET jQuery Cookbook - Second Edition by Sonal Aneel Allana

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving data from a Web API

A Web API (Web Application Programming Interface) is a HTTP API that is created using the .NET framework. It uses the HTTP protocol to return data. Since HTTP is available universally across a wide range of platforms, these APIs can be used on Web and mobile platforms and across various devices.

In this example, we will use jQuery Ajax to post a request to a Web API. The constructs used in this example are summarized in the following table:

Construct

Type

Description

$("#identifier")

jQuery selector

This selects an element based on its ID.

$("html_tag")

jQuery selector

This selects all elements with the specified HTML tag.

$.getJSON()

jQuery function

This loads the JSON data from the server using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required