Questions tagged [unobtrusive-ajax]

Question regarding Microsoft jQuery plugin for Unobtrusive Ajax

99 questions
1
vote
0 answers

Clicking Ajax.ActionLink Produces a GET and a POST

Clicking a certain Ajax ActionLink in this app I just inherited produces a POST request AND a GET request (POST and then a GET immediately after). The first request hits the HttpPost method on the server, but the second request (the GET) throws a…
CJ314
  • 11
  • 1
  • 1
1
vote
0 answers

ASP.NET core (VS code) how to install Unobtrusive Ajax library

I am using Visual Code and would like to install Unobtrusive Ajax library. In Visual Studio, Unobtrusive Ajax library can be installed via Nuget. However, I cannot find a way to install Unobtrusive Ajax library in VS code.
Pardeep
  • 141
  • 2
  • 10
1
vote
1 answer

Stop previous unobtrusive ajax call

I have a form like : @using (Ajax.BeginForm("List", null, new AjaxOptions() { UpdateTargetId = "results" }, new { id = "myform" })) { } I declare javascript to send submit when user presses a key in…
GGO
  • 2,700
  • 3
  • 16
  • 35
1
vote
0 answers

Returning BadRequest in ASP.Net Core MVC to Microsoft jQuery Unobtrusive Ajax post has ModelState undefined

THE PROBLEM I am trying to return service side validation errors from ModelState using BadRequest(ModelState) but when I try to assign the the jQuery ModelState from xhr.responseText I am getting undefined error in javascript. I am using ASP.Net…
OjM
  • 735
  • 2
  • 10
  • 21
1
vote
1 answer

Conflict between unobtrusive-ajax and jQuery

I have an MVC4 project where I've used NuGet to install jQuery 3.1.0 and Microsoft.jQuery.Unobtrusive.Ajax 3.2.3. My bundle is this: bundles.Add(new ScriptBundle("~/bundles/scripts").Include( "~/Scripts/jquery-3.1.0.min.js", …
BKahuna
  • 571
  • 2
  • 10
  • 22
1
vote
0 answers

MVC C# PagedList - PagedListPager passing parameters

I have a paged list using unobtrusive ajax that looks like this. @Html.PagedListPager(Model, page => Url.Action("Images", "Admin", new { imageLibrary = image.ImageLibrary, page }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new…
Michael Buchok
  • 342
  • 5
  • 15
1
vote
0 answers

ASP.NET MVC Ajax.BeginForm file upload not being unobtrusive

I have the following in my View
@using (Ajax.BeginForm("UploadAdditionalImage", "Image", "UploadAdditionalImage", ajaxOptions, new { enctype = "multipart/form-data" })) {
1
vote
1 answer

How to extend Microsoft jQuery Unobtrusive Ajax without changing jquery.unobtrusive-ajax.js file?

jquery.unobtrusive-ajax.js looks like the following: I would like to add the following event to the library so that I can use asyncRequest() function but in a different file. $(document).on("change", "select[data-ajax=true]", function (evt) { …
Amit Hasan
  • 1,230
  • 1
  • 14
  • 30
1
vote
1 answer

AJAX Form redirects instead of updating target

I know this question has been asked a lot and I have tried every solution I can find but I still cannot get my Ajax form to update the DIV rather then redirecting to the Action Method e.g(Local..Home/Index_AddUser). I have shortened the code as it…
hjardine
  • 495
  • 3
  • 15
1
vote
1 answer

Calling javascript function on OnSuccess callback of Ajax.actionlink?

I am using MVC5. I am loading images from a list using Unobtrusive Ajax.ActionLink(). Here is the sample code:-
    @foreach (var item in Model) {
  • @Ajax.ActionLink(@item.Name, @item.Action, …
user1327064
  • 3,627
  • 4
  • 15
  • 25
1
vote
0 answers

MVC unobtrusive ajax: send textbox value as query string with ajax action-link GET request

In the sample code below, I have ajax action-link sending out a GET request. I want to send the value of Message text-box as query string for the request. I know this can be done with ajax-forms. But I was wondering if there's anything I can put in…
achhetri
  • 11
  • 2
1
vote
1 answer

MVC Ajax ActionLink replaces the entire bootstrap modal-body

The Ajax.ActionLink below has an empty AjaxOptions. Surprisingly it automagically renders the ajax response into the modal and replaces the entire .modal-body element. My intention is to render the response into the #ItemCommentModalBody div. No…
mortdale
  • 372
  • 4
  • 15
1
vote
2 answers

ASP.NET MVC : unobtrusive-ajax for dynamically added forms

I'm loading an Ajax Form inside a popup. the popup content is written client side. unobtrusive-ajax is not triggered by the form. and its events are not called. This is because of loading the Ajax Form dynamically. and unobtrusive-ajax is not binded…
abzarak
  • 663
  • 1
  • 10
  • 27
1
vote
0 answers

Problems with Ajax.BeginForm when dynamically loaded

I have a search page on an ASP.NET MVC5 application. There is a dropdown in the corner and if you select "User Search" the search filters for users appears. If you select "Task Search" the search filters for task shows. These filters are being…
Lotok
  • 3,925
  • 1
  • 28
  • 42
1
vote
1 answer

Using jquery.unobtrusive-ajax.js on @Ajax.ActionLink in ajax loaded partial views

In _Layout.cshtml: @RenderBody() @Scripts.Render("~/scripts/jquery.unobtrusive-ajax.js") Running the script activates all the @Ajax.ActionLink in index.cshtml. Some ajax action links load a partial view via ajax, and these partial views include…
allenylzhou
  • 1,371
  • 2
  • 16
  • 34