Mvc icon indicating copy to clipboard operation
Mvc copied to clipboard

AjaxHelper

Open ghost opened this issue 11 years ago • 14 comments

Hi, I see that the AjaxHelper has been removed into project. Has been replaced by another helper or will be developed later ?

ghost avatar Feb 13 '15 08:02 ghost

We don't have any immediate plans to support AjaxHelper in MVC 6, but we are certainly interested in customer feedback on the importance of supporting this in MVC 6. Putting this on our backlog for now.

danroth27 avatar Feb 16 '15 17:02 danroth27

Hi Danroh27, Don't understand why AJAX helper is not available ? this is very basic. do you have some alternative ? i am surprised by this ignorance of Microsoft team.

If this is not available then we have to go back to MVC 5.

Can you suggest any alternative way apart from J query ?

rahuldhariya01 avatar May 29 '15 19:05 rahuldhariya01

Hi rahuldhariya01, Actually, i write the ajax tags data-ajax-* directly without helper, finally it is ease and is still readable. The autocompletion support would be useful in the source editor.

ghost avatar May 30 '15 05:05 ghost

Thanks Branciat. Even I tried the same but now success, failed ,onbegin,on completion event into this ?

rahuldhariya01 avatar May 30 '15 09:05 rahuldhariya01

An example of ajax action

<a href="@Url.RouteUrl("CoreApi", new { area = "Core", controller = "PostalAddress", action = actionName, id = Model })" class="hidden" data-ajax="true" data-ajax-mode="replace" data-ajax-failure="showError" data-ajax-update="#post_addr_form" id="pa_load_form"></a>

data-ajax="true" is required, data-ajax-mode can be to have a value as replace, before, after,... You use javascript function without parameter for each data-ajax-(failure, success, begin), it seems to me. Of course, added the jquery-ajax-unobtrusive script into the layout.

See the brad wilson's blog http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-ajax.html for a comparison AjxHelper and the html generated, also in complement the source code ajax unobtrusive.

ghost avatar May 30 '15 14:05 ghost

Pulling back into the release based on customer feedback.

danroth27 avatar Jun 03 '15 17:06 danroth27

We are not going to get to this in this release.

danroth27 avatar Jul 16 '15 19:07 danroth27

jQuery ajax unobtrusive is open source and can be bower pulled.

As @branciat mentioned the data attributes for the call can be used.

+------------------------+-----------------------------+
|      AjaxOptions       |       HTML attribute        |
+------------------------+-----------------------------+
| Confirm                | data-ajax-confirm           |
| HttpMethod             | data-ajax-method            |
| InsertionMode          | data-ajax-mode              |
| LoadingElementDuration | data-ajax-loading-duration  |
| LoadingElementId       | data-ajax-loading           |
| OnBegin                | data-ajax-begin             |
| OnComplete             | data-ajax-complete          |
| OnFailure              | data-ajax-failure           |
| OnSuccess              | data-ajax-success           |
| UpdateTargetId         | data-ajax-update            |
| Url                    | data-ajax-url               |
+------------------------+-----------------------------+

afnpires avatar Jan 19 '16 22:01 afnpires

  1. Please, add pushState to it when porting to ASP.NET Core 1.0. This was really strange to miss this feature in unobtrusive ajax script. Good example on this is how Turbolinks work in Rails.
  2. Also, I personally find it important to name it differently. "Unobtrusive" is fair enough, but it is not related neither to AJAX, nor to partials, links, pushState and so on. Again, Turbolinks sets the benchmark here.

EvAlex avatar Feb 23 '16 15:02 EvAlex

The future is not AjaxHelper is the main method, but if the existing MVC4 project ported to aspnetCore, this is very necessary

ghost avatar Jul 10 '16 11:07 ghost

The Ajax Helper will endup being the stumbling block when porting to Aspnet5 ore like now 😨

aecuman avatar Aug 08 '16 23:08 aecuman

@danroth27 Any update on this ? Is this something still in the backlog or completely dropped ?

kshyju avatar Aug 28 '16 17:08 kshyju

I think its totally possible for you to create your own AJAX extensions even if it is missing from ASP.NET Core. It seems that someone already did that, so all you need is to add it to your project and maybe modify it slightly if some code aint working: https://github.com/mono/aspnetwebstack/blob/master/src/System.Web.Mvc/Ajax/AjaxExtensions.cs

HallofFamer avatar Oct 24 '16 17:10 HallofFamer

Closing because we have no plans to support this.

Eilon avatar Nov 15 '16 18:11 Eilon