info: Fix JavaScript to support older versions of CiviCRM and jQuery.
[org.fsf.memberdashboard.git] / assets / js / member-info.js
index d3a5e4f150fa6af257673f03913fbd1e7a2935df..b4ff8d0857e64c16f770355f16bbaa15063b6a29 100644 (file)
@@ -21,7 +21,7 @@
 
 (function($) {
   function loadProfile(gid, success) {
-    $.get('/drupal/civicrm/profile/edit', {
+    $.get('/civicrm/profile/edit', {
       gid: gid,
       json: 1
     }, success);
@@ -42,6 +42,9 @@
         .value();
     }
 
+    // Support older versions of jQuery that don't parse the JSON by
+    // default.
+    profile = _.isString(profile) ? JSON.parse(profile): profile;
     var form = $('<form' + profile.attributes + '></form>');
 
     form.append(profile.requirednote)
@@ -49,7 +52,7 @@
       .append.apply(form, renderFields());
 
     $('#info-loading').remove();
-    $('#crm-main-content-wrapper').append(form);
+    $('#info-form').append(form);
   }
 
   $(document).ready(function() {