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: @fejesjoco, you read correctly, the imperative Ajax format is no longer supported. I'm not sure if there was ever a package with MicrosoftMvcAjax.js, but you can find them on the CDN - http://www.asp.net/ajaxlibrary/cdn.ashx#ASPNET_MVC_Releases_on_the_CDN_16. That said, if this work item gets approved, I wouldn't be averse to the idea of having a ajax-request event, so you'd be able to do something like $("#foo").trigger("ajax-request", params) to force trigger Ajax events.
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: @fejesjoco, you read correctly, the imperative Ajax format is no longer supported. I'm not sure if there was ever a package with MicrosoftMvcAjax.js, but you can find them on the CDN - http://www.asp.net/ajaxlibrary/cdn.ashx#ASPNET_MVC_Releases_on_the_CDN_16. That said, if this work item gets approved, I wouldn't be averse to the idea of having a ajax-request event, so you'd be able to do something like $("#foo").trigger("ajax-request", params) to force trigger Ajax events.