Skip to content

Instantly share code, notes, and snippets.

@mdix
Created November 15, 2013 21:22
Show Gist options
  • Save mdix/7491860 to your computer and use it in GitHub Desktop.
Save mdix/7491860 to your computer and use it in GitHub Desktop.
2
var setUserProfileValuesFromJson = function () {
var configuration = {
url: dataUrl,
type: 'GET',
dataType: 'json'
};
var handleData = function (data) {
user = data.data;
// Fill display data
updateDisplayData(user);
// Fill form data (initially hidden)
updateFormWithJson(user);
};
var handleFailure = function (data) {
throw new Error('json request failed: ' + data.statusText);
};
var request = $.ajax(configuration).done(handleData).fail(handleFailure);
requests.push(request);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment