Categories
CMS Drupal Mastering Development

How do I add a button with a custom redirect to a node view?

I’d like to add a "More info" button to the bottom of a node view. The button should redirect the user to a URL based on the current node, e.g. node/1/info: /** * Implements hook_node_view * * Add the "More Info" button to idea content */ function implementations_node_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) { […]

Categories
AJAX Development

datatable with dynamically created table

Inside an ajax success, I am appending trying to rows into an already existing datatable. The append became successful but it looses datatable features. Please refer my code below. $(document).ready(function () { $(document).on(‘click’, ‘.btn-primary’, function(evt){ evt.preventDefault() $.ajax({ type: “POST”, url: “hello.aspx/ProcessMe”, data: ‘{id: “‘ + $(this).prev().val() + ‘” ,dept:”‘ + $(this).prev().prev().val() + ‘”}’, contentType: “application/json; […]