Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function ($) {
  2.     Drupal.behaviors.watfaq = {
  3.         attach: function(context, settings) {
  4.             $("#type").change(function() {
  5.                 var valeur = jQuery("#type").val(); //valeur renvoyee par le select
  6.                 jQuery.ajax({
  7.                     url : Drupal.settings.basePath + 'FAQ/' + valeur + '/ajaxsearch',
  8.                     success : function(data) {
  9.                         jQuery("#accordion").fadeOut(0, function(){
  10.                             jQuery("#accordion").accordion('destroy');
  11.                             jQuery('#accordion').html('<h3><a href="#">' + data[0].title + '</a></h3><div><p>' + data[0].value + "</p></div>");
  12.                             jQuery("#accordion").accordion({ clearStyle: true });
  13.                                 //on la ré-affiche avec un effet de transparence
  14.                                 jQuery("#accordion").fadeIn(1000);
  15.                         });
  16.                     }
  17.                 });
  18.             });
  19.         }
  20.     };
  21. }(jQuery));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement