Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Upgrade

jQuery getJSON() Method

❮ jQuery AJAX Methods


Get JSON data using an AJAX request, and output the result:

  $.getJSON("demo_ajax_json.js", function(result){
    $.each(result, function(i, field){
      $("div").append(field + " ");
Try it Yourself »

Definition and Usage

The getJSON() method is used to get JSON data using an AJAX HTTP GET request.



Parameter Description
url Required. Specifies the url to send the request to
data Optional. Specifies data to be sent to the server
success(data,status,xhr) Optional. Specifies the function to run if the request succeeds
Additional parameters:
  • data - contains the data returned from the server.
  • status - contains a string containing request status ("success", "notmodified", "error", "timeout", or "parsererror").
  • xhr - contains the XMLHttpRequest object

❮ jQuery AJAX Methods