glossary_manual.js.html.twig 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. var ajaxRequestUrl = "{{ _p.web }}main/glossary/glossary_ajax_request.php?{{ _p.web_cid_query }}";
  2. var imageSource = "{{ _p.web_main }}" + "inc/lib/javascript/indicator.gif";
  3. var indicatorImage ='<img src="' + imageSource + '" />';
  4. {% if add_ready %}
  5. $(function() {
  6. {% endif %}
  7. $("body").on("click", ".glossary", function() {
  8. is_glossary_name = $(this).html();
  9. random_id = Math.round(Math.random()*100);
  10. div_show_id = "div_show_id";
  11. div_content_id = "div_content_id";
  12. $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
  13. var $target = $(this);
  14. //$("#"+div_show_id).dialog("destroy");
  15. $("#"+div_show_id).dialog({
  16. autoOpen: false,
  17. width: 600,
  18. height: 200,
  19. position: { my: 'left top', at: 'right top', of: $target },
  20. close: function(){
  21. $("div#"+div_show_id).remove();
  22. $("div#"+div_content_id).remove();
  23. }
  24. });
  25. $.ajax({
  26. contentType: "application/x-www-form-urlencoded",
  27. beforeSend: function(result) {
  28. $("div#"+div_content_id).html(indicatorImage);
  29. },
  30. type: "POST",
  31. url: ajaxRequestUrl,
  32. data: "glossary_name="+is_glossary_name,
  33. success: function(data) {
  34. $("div#"+div_content_id).html(data);
  35. $("#"+div_show_id).dialog("open");
  36. }
  37. });
  38. });
  39. {% if add_ready %}
  40. });
  41. {% endif %}