The way I see it, I can create `form` or `a` elements, decorated with the data attributes. The unobtrusive script listens for form submit and anchor click events. There is no way to interact with the internals of the script.
I would like to ask for the following feature. I would like to trigger the `asyncRequest` function from my JavaScript code. `AjaxOptions.ToUnobtrusiveHtmlAttributes()` is luckily public, so I can for example create a `div` or anything and decorate that. Then I could implement any logic and do an ajax call without user interaction.
Also, less important to me, but it would also be nice to enable other elements, not just anchors. For example images, buttons, or anything. I understand that the `form` submit handler is a special case, but if you look at the code of the anchor handler, it goes straight to `asyncRequest`. It is a bit redundant because if you enable calling `asyncRequest` from outside, then of course I can glue any kind of user event to call it.
Comments: As I was investigating further, I found out that `Ajax.ActionLink` and `Ajax.BeginForm` don't require unobtrusive ajax support. If it is disabled, then instead of data attributes, they emit imperativs JS code, like `Sys.Mvc.AsyncForm.handleSubmit`, which should be found in a file called `MicrosoftMvcAjax.js` and/or `MicrosoftAjax.js`. If it is still supported, then I could use the same kind of imperative syntax for my own purposes. However, I read in some places that this is now obsolete and unobtrusive ajax is the only supported method, and I failed to find the Nuget package that provides this. I still think it would be great if there was a public interface to unobtrusive ajax, as I asked before. But I would like to know what's the consensus about the state of non-unobtrusive ajax: can I and/or should I support it?
I would like to ask for the following feature. I would like to trigger the `asyncRequest` function from my JavaScript code. `AjaxOptions.ToUnobtrusiveHtmlAttributes()` is luckily public, so I can for example create a `div` or anything and decorate that. Then I could implement any logic and do an ajax call without user interaction.
Also, less important to me, but it would also be nice to enable other elements, not just anchors. For example images, buttons, or anything. I understand that the `form` submit handler is a special case, but if you look at the code of the anchor handler, it goes straight to `asyncRequest`. It is a bit redundant because if you enable calling `asyncRequest` from outside, then of course I can glue any kind of user event to call it.
Comments: As I was investigating further, I found out that `Ajax.ActionLink` and `Ajax.BeginForm` don't require unobtrusive ajax support. If it is disabled, then instead of data attributes, they emit imperativs JS code, like `Sys.Mvc.AsyncForm.handleSubmit`, which should be found in a file called `MicrosoftMvcAjax.js` and/or `MicrosoftAjax.js`. If it is still supported, then I could use the same kind of imperative syntax for my own purposes. However, I read in some places that this is now obsolete and unobtrusive ajax is the only supported method, and I failed to find the Nuget package that provides this. I still think it would be great if there was a public interface to unobtrusive ajax, as I asked before. But I would like to know what's the consensus about the state of non-unobtrusive ajax: can I and/or should I support it?