Sunday, October 14, 2018

jQuery - How to parse the server response as JSON?

Pretty simple.

For dictionaries, below given

var obj = jQuery.parseJSON( '{ "name": "John" }' );
 $.each( appointments, function( key, val ) {
 }

for arrays, it is

var appointments = jQuery.parseJSON( response);
 $.each( appointments, function( index, val ) {
 }

references:
http://api.jquery.com/jquery.parsejson/

No comments:

Post a Comment