📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials jQuery in Practice $.get and $.post

$.get and $.post

5 min read
$.get() fetches data, $.post() sends data, and $.getJSON() fetches and parses JSON automatically. All return jqXHR Promises. $('#content').load('/partial.html') fetches HTML and injects it into the element.

Shorthand AJAX

// GET
$.get('/api/users', function(data) {
  console.log(data);
});

// POST
$.post('/api/users', { name: 'Alice' }, function(res) {
  console.log(res);
});

// JSON shorthand
$.getJSON('/api/data', function(json) {
  console.log(json);
});