Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
jQuery

JSON with jQuery

Parse and send JSON with dataType json and JSON.stringify.

JSON with jQuery — a practical guide to jQuery JSON with clear examples you can reuse in real projects.

jQuery Tutorial Series (71/101). Prefer one article? Read the complete jQuery tutorial.

Short description

$.getJSON is a shortcut for GET + JSON parsing.

JSON

$.getJSON('/api/user', function (user) {
  $('#name').text(user.name);
});

$.ajax({
  url: '/api/user',
  method: 'POST',
  contentType: 'application/json',
  data: JSON.stringify({ name: 'Asha' })
});

Leave a reply

Your email address will not be published. Required fields are marked *