Questions tagged [unobtrusive-ajax]

Question regarding Microsoft jQuery plugin for Unobtrusive Ajax

107 questions
3
votes
1 answer

ASP.NET MVC4 Ajax.ActionLink replaces entire page

In my view I have: @section Header { @Scripts.Render("~/bundles/jqueryval") }
@Ajax.ActionLink("Test", "CurrentTime", new AjaxOptions { UpdateTargetId = "some_div", InsertionMode = InsertionMode.InsertAfter…
2
votes
1 answer

Stuck With Unobtrusive and Client Side validations

Hope everyone is doing great. I am using some unobtrusive jQuery in my razor pages .NET core 3.1, for form submission:
2
votes
1 answer
2
votes
0 answers

Unobtrusive Ajax lib Not sending XmlHttpRequest header

We're trying to implement a simple 'subscribe to our newsletter' form with the help of the aspnet Unobtrusive Ajax (js) library. We noticed (using Fiddler) that there is no XmlHttpRequest header being sent to the server. What can we do to resolve? …
Sijmen Koffeman
  • 141
  • 1
  • 6
2
votes
0 answers

Getting a 415 Unsupported Media Type error when posting an ASP.NET Core MVC form with unobtrusive ajax

I am creating an ASP.NET MVC Core web application. I have a form in my View that posts to the Create action in the ProductsController. I am using jquery unobtrusive ajax so my form looks like the following:
Blake Rivell
  • 13,105
  • 31
  • 115
  • 231
2
votes
2 answers

Rendering a partial View with Ajax Unobtrusive

I have the following View and Partial View. In the index action method I need the Create to rendered as a Partial View. Based on the answer in this question I tried using Ajax helper methods(I find AJAX and JS so hard for me to comprehend). @model…
Vini
  • 1,978
  • 8
  • 40
  • 82
2
votes
1 answer

MVC Multiple Ajax Calls

I am having trouble making ajax calls in my MVC application. I have tried two different ways to be able to have an ajax actionlink load a partial and then that partial submit a form as an ajax call, but I am having trouble. First Attempt // will…
Beastwood
  • 446
  • 3
  • 19
2
votes
1 answer

Global Events With Unobtrusive Ajax

When Unobtrusive ajax performs an ajax call, it doesn't appear to call the global jquery ajax events. Here is an example of my attempt to handle the event. $(document).ajaxComplete(function () { alert('test'); }); The event works fine if I make…
Nathan A
  • 11,059
  • 4
  • 47
  • 63
2
votes
0 answers

Prevent the user from using the browser's backwards and forwards functionality using MVC 3, C# and unobtrusive-ajax

Problem: Prevent the user from using the browser's backwards and forwards functionality. Using: MVC 3 C# Microsoft Visual Studio 2010 .net framework 4.0 unobtrusive-ajax I have a working MVC3 application using Html.BeginForm and friends in an…
2
votes
1 answer

unobtrusive ajax form prevent cancel button from posting

Question: Why is cancel button posting to the controller like submit? I have the form below loaded from a partial view. Submit works fine. The only thing I've been struggling with is why Cancel doesn't just dismiss the form. I've tried a variety of…
Joel
  • 647
  • 2
  • 11
  • 22
1
vote
2 answers

4 time same ajax request by one ajax call, why?

I have the following code in MVC 3.0 with unobtrusive JavaScript enabled. using (Ajax.BeginForm("search", new { puremode = 1 }, new AjaxOptions(){ UpdateTargetId="searchResult"} )) {
aaa
Mahmoud Moravej
  • 8,705
  • 6
  • 46
  • 65
1
vote
2 answers

Unobtrusive Ajax w/ Unobtrusive Validation

I have a form with a single textbox. The field bound to that textbox is required. When I post the form with that textbox empty I get ModelState.IsValid = False as expected. But, the form still fires the data-ajax-success. Relevant .cshtml
s15199d
  • 7,261
  • 11
  • 43
  • 70
1
vote
1 answer

Confirm Delete in unobtrusive ajax is not working

I have this form:
mz1378
  • 1,957
  • 4
  • 20
  • 40
1
vote
1 answer

ASP.NET MVC Unobtrusive Ajax is still obtrusive in mobile Safari

If I use Ajax.ActionLink in my ASP.NET MVC 3 app, when I browse the site with mobile Safari and click my ajax links, the browser address bar drops down and briefly shows the POST url. Not a huge deal, but it is distracting and most Ajax-enabled…
kenwarner
  • 28,650
  • 28
  • 130
  • 173
1
vote
0 answers

How do I capture an Ajax error in the data-ajax-failure function of my form in ASP.NET Core?

I want to capture my error message in the data-ajax-failure portion of my form which uses unobtrusive ajax. It's easy to do this if the form is posted via a function which calls $ajax but I'm not doing that with this, I'm placing both my success…
Yanayaya
  • 2,044
  • 5
  • 30
  • 67