Html.BeginForm PUT

It seems impossible to determine the PUT when I use Html.BeginForm to submit the form when the element is updated. Is it correct?

+3
source share
3 answers

Yes, it's right. Browsers only support GET and POST for submitting forms. You can use AJAX:

$.ajax({
    url: '/action',
    type: 'PUT',
    data: { param1: 'value1' },
    success: function(result) {

    }
});

And if you want to submit an AJAXify form, you can see the jquery.form plugin .

+2
source

If you are using ASP.NET MVC 2, check out the Html.HttpMethodOverride and HttpPutAttribute methods.

ASP.NET MVC 1.0 also checks the source code for MVC 2. The HttpRequestExtensions.GetHttpMethodOverride method is really cool!

+2
source

... , "" / html ?

According to the HTML4 specification, the Form element only supports GET and POST. Technically, any browser that allows the use of other verbs will not meet the specification. It looks like HTML5 will support other verbs.

Edit: and now it looks like I can reference both documents.

+1
source

Source: https://habr.com/ru/post/1737031/


All Articles