load_block_on_ajax-8.x-1.0/js/load_block_on_ajax.js

js/load_block_on_ajax.js
/**
 * @file
 */
var bool_load_block_on_ajax = false;
(function ($) {
	Drupal.loadBlockOnAjax = function () {
	    $('div[id^=load-block-on-ajax-wrapper--]').click(function () {
			if( false == bool_load_block_on_ajax ) {
			  bool_load_block_on_ajax = true;
		      var arr_block_id = $(this).attr('id').split("--");
		      var str_block = $(this);
		      $.ajax({
		        url: drupalSettings.path.baseUrl + "load-block-on-ajax/" + arr_block_id[1],
		        method :'GET',
		        dataType: "json",
		        success: function (data) {
		        	str_block.append( '<img src="' + drupalSettings.path.baseUrl + 'modules/custom/load_block_on_ajax/images/loader.gif" alt="Loading Image" height="42" width="42">' )
		        	str_block.html( data );
		        }
		      });
			}
	    });
	}
	$(document).ready(function () {
		Drupal.loadBlockOnAjax();
	});

})(jQuery);

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc