Skip to content

Instantly share code, notes, and snippets.

@robap
Last active December 12, 2015 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robap/4747480 to your computer and use it in GitHub Desktop.
Save robap/4747480 to your computer and use it in GitHub Desktop.
The difference between partial html ajax and json
//partial html can simply be inserted into the dom
$('.ajax-content').html(data);
//json needs to be mapped
$('#form_id').val(data['id']);
$('#form_firstName').val(data['firstName']);
$('#form_lastName').val(data['lastName']);
$('#form_phone').val(data['phone']);
$('#form_street').val(data['street']);
$('#form_city').val(data['city']);
$('#form_state').val(data['state']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment