Timeline for How can I invoke an AJAX response?
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 27, 2018 at 3:05 | review | First posts | |||
Aug 27, 2018 at 3:17 | |||||
Aug 17, 2018 at 14:21 | comment | added | Trey D | I do have a link that calls my controller and this is the only page where the JavaScript call works. I want to call the controller automatically on other pages through my JavaScript. Is there a way to do this? | |
Aug 17, 2018 at 13:28 | comment | added | Kevin | At a very high level, I think you want a link that has a class of "use-ajax" on it whos callback hits your controller, the controller returns an AjaxResponse to trigger the modal. I don't understand your JS above, because that code will fire AJAX every single page. At the same time, The JS will need to conform to be a Drupal behavior so it is compatible. drupal.org/docs/8/api/javascript-api/javascript-api-overview | |
Aug 17, 2018 at 5:39 | history | edited | avpaderno♦ | CC BY-SA 4.0 |
edited title
|
Aug 16, 2018 at 18:29 | history | edited | Trey D | CC BY-SA 4.0 |
edited body
|
Aug 16, 2018 at 15:43 | history | edited | Pierre.Vriens |
edited tags
|
|
Aug 16, 2018 at 15:40 | review | Close votes | |||
Aug 16, 2018 at 15:43 | |||||
Aug 16, 2018 at 15:37 | comment | added | Trey D | I've added my javascript where I'm trying to invoke the ajax. I'm sort of tricking the ajax call to run with a success call on Drupal.ajax(). This worked for my route path for the form but it throws an error on other pages. | |
Aug 16, 2018 at 15:34 | history | edited | Trey D | CC BY-SA 4.0 |
added 910 characters in body
|
Aug 16, 2018 at 15:23 | comment | added | leymannx | Welcome to Drupal Answers! Please update your question to include a properly documented code snippet of what you've done so far. | |
Aug 16, 2018 at 15:14 | history | asked | Trey D | CC BY-SA 4.0 |