function getContact(id, callback) { $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", datatype: "json", url: Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/ContactSet(guid'" + contactId + "')", beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); }, async: true, success: function (data, textStatus, xhr) { callback(data.d); }, error: function (xhr, textStatus, errorThrown) { console.error(errorThrown); } }); }