Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Asp.net recognize Ext JS form submittion as an Ajax request?

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?

like image 998
KallDrexx Avatar asked Nov 30 '25 15:11

KallDrexx


1 Answers

Yuo can alway add hidden parameter in you form what will determ that this request is via AJAX

like image 84
bensiu Avatar answered Dec 03 '25 05:12

bensiu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!