Reputation: 27833
It seems like by default, Asp.net does not recognize Ext JS getForm().submit()
calls as an ajax request. This is causing an issue for me because I am trying to return a JsonResult
instead of a view if the request was made via Ajax.
However, when the following gets called
this.getForm().submit({
url: url,
waitMsg: 'Saving Request Details',
scope: this,
success: function (form, o) {
...
},
failure: function (form, o) {
...
}
});
inside of my Asp.net MVC action that gets called, HttpContext.Request.IsAjaxRequest()
is returning false.
How can I make it so Asp.Net correctly recognizes the request as an ajax request?
Upvotes: 3
Views: 471
Reputation: 25604
Yuo can alway add hidden parameter in you form what will determ that this request is via AJAX
Upvotes: 2
Reputation: 50728
That extension looks for a value in the header or in the request collection of key "X-Requested-With" with a matching value of "XMLHttpRequest". You would have to set the value when you make the request because it seems like extJS isn't.
Try including an X-Requested-With entry within the form results and see if that remedies it.
HTH.
Upvotes: 2