tripal.js 820 B

1234567891011121314151617181920212223
  1. // Using the closure to map jQuery to $.
  2. (function ($) {
  3. // Store our function as a property of Drupal.behaviors.
  4. Drupal.behaviors.myModuleSecureLink = {
  5. attach: function (context, settings) {
  6. $(".tripal-entity-unattached .field-items").replaceWith('<div class="field-items">Loading... <img src="' + tripal_path + '/theme/images/ajax-loader.gif"></div>');
  7. $(".tripal-entity-unattached").each(function() {
  8. id = $(this).attr('id');
  9. $.ajax({
  10. url: baseurl + '/bio_data/ajax/field_attach/' + id,
  11. dataType: 'json',
  12. type: 'GET',
  13. success: function(data){
  14. var content = data['content'];
  15. var id = data['id'];
  16. $("#" + id + ' .field-items').replaceWith(content);
  17. }
  18. });
  19. });
  20. }
  21. }
  22. })(jQuery);