5

OK, I find it EXTREMELY ridiculous that I have to post a new question to find the answer but, alas here I am. Let's make this as simple as possible for the next wayward soul looking to resolve this.

What are all the most current scripts I require to get the ajax form working? Thus far I have;

<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.12.0/jquery.validate.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/mvc/5.0/jquery.validate.unobtrusive.min.js"></script>

I have seen pages that state I need jquery.unobtrusive-ajax.js as well, but that just gives me an error. Do I have some incompatible versions loaded?

I've worked with this several times in the past for MVC3 etc, but it's just silly that I cannot seem to find a simple page explaining the code expectations for the current version.

Thank you in advance to anyone who can help me remove my head from where it appears to be firmly stuck this afternoon.

Jasen
  • 14,030
  • 3
  • 51
  • 68

1 Answers1

16

The very minimum you need for AjaxHelper

NuGet Package Microsoft jQuery Unobtrusive Ajax 3.1.2

> Install-Package Microsoft.jQuery.Unobtrusive.Ajax -Version 3.1.2

Now include the scripts

<script src="~/jquery-1.11.0.js"></script>
<script src="~/jquery.unobtrusive-ajax.js"></script>

Go ahead and get the latest version if available. I specified v3.1.2 to demonstrate that the AjaxHelper worked for at least this particular version at a particular time.

Jasen
  • 14,030
  • 3
  • 51
  • 68
  • 1
    You my friend rock!! Not sure why it was troublesome for me but I am now Good to go. My final load list is; jQuery, jQueryUI, jquery.unobtrusive-ajax-3.2.0 (released yesterday), jquery.validate, and finally jquery.validate.unobtrusive. Now the hooks for the prompts and functionality work all as expected. Happy day indeed, thank you my friend. – Alex Pearlstein May 28 '14 at 16:52
  • I find it odd that a for a new MVC 5 project template the jquery.unobtrusive-ajax.js library is not included in the project. Why have the Ajax.BeginForm helper as part of the MVC framework and then not include the required script library for a new project?!? – landsteven May 11 '16 at 18:53
  • @landsteven not everyone cares to use the `AjaxHelper` and would rather use `jQuery.ajax()` directly. – Jasen May 11 '16 at 20:54