Guest User

Untitled

a guest
Nov 18th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. function test_terms_load() {
  2.  
  3. $vocabulary = taxonomy_vocabulary_machine_name_load('test_vc');
  4. $tree = taxonomy_get_tree($vocabulary->vid);
  5.  
  6. $ecf_data = '';
  7. $ecf_data .= '<div class="test-class"><table width="50%">';
  8. $ecf_data .= '<tr><th>Titles</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th></tr>';
  9. foreach ($tree as $key => $term) {
  10. $ecf_data .= '<tr>';
  11. $ecf_data .= '<td>' . $term->name . '</td>';
  12. for($i=1; $i<=5; $i++) {
  13. $ecf_data .= '<td><input type="checkbox" name=' . $term->name . '-' . $i . '></td>';
  14. }
  15. $ecf_data .= '</tr>';
  16. }
  17. $ecf_data .= '</table></div>';
  18.  
  19. print $ecf_data;
  20. }
  21.  
  22. $("[class^='testing-']").click(function(e) {
  23.  
  24. var nodeid = $(this).attr('id');
  25. alert(nodeid + ' - ' +Drupal.settings.basePath + Drupal.settings.pathPrefix );
  26. $.ajax({
  27. method: "POST",
  28. url: Drupal.settings.basePath + Drupal.settings.pathPrefix + "testing/ajax/"+nodeid,
  29. success: function(result){
  30. if(result.length > 0) {
  31. alert(result);
  32. $(result).appendTo(".course_titles");
  33. //$(".messages").html(result);
  34. }else {
  35. alert('empty');
  36. }
  37. }
  38. });
  39. });
Add Comment
Please, Sign In to add comment