Hot answers tagged

4

You have to add ajax commands to the ajax response, using the unrendered render array: $response->addCommand(new ReplaceCommand('#form-container', $renderable)); BTW you can only return a Drupal ajax response if you have triggered an ajax request via ajax.js. Outside of form submits you usually do this by adding the class use-ajax to a link. For custom ...


1

You can trigger Ajax in custom javascript. See How to Trigger Existing, Non-Form Ajax from JavaScript Event In your case an Ajax dialog: var ajaxSettings = { url: '/node/1', dialogType: 'modal', dialog: { width: 400 }, }; var myAjaxObject = Drupal.ajax(ajaxSettings); myAjaxObject.execute();


Only top voted, non community-wiki answers of a minimum length are eligible