How to get and parse the JSON data in jQuery

Getting and parsing JSON data in jQuery:

$.getJSON(URL, [data], [callback]);

URL - server side resource communicated via GET method.

data - an object whose properties as name/value pairs to be appended as a query string with the URL.

callback - a function will be invoked and can parses the resulting JSON string as the first parameter and second parameter for status.

Example jQuery to get JSON data and parses in callback function:

<script type="text/javascript" language="javascript">

    $.getJSON('/result.json', function(student){
      $('#result').append('<p>Name: ''</p>');
      $('#result').append('<p>Grade: '+student.grade+'</p>');



Privacy Policy  |  Copyrightcopyright symbol2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter