Bonjour,

j'ai un formulaire
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
@using (Html.BeginForm("Details", "Return", null, FormMethod.Post))
{ ... }
et du code js :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
$(document).ready(function () {
 
            $('form').submit(function () {
                var parameters = [];
                $('table tr').each(function () {
                    var orderlineid;
                    var returnedquantity;
                    var complet;
                    var outoforder;
                    var isreturncustomer;
                    var isreturntoprovider;
                    var comment;
 
                    $(this).find("td input").each(function () {
                        if ($(this).attr("name") == "orderlineid") {
                            orderlineid = this.value;
                        }
                        else if ($(this).attr("name") == "returnedquantity") {
                            returnedquantity = this.value;
                        }
                        else if ($(this).attr("name") == "complet") {
                            complet = this.value;
                        }
                        else if ($(this).attr("name") == "outoforder") {
                            outoforder = this.value;
                        }
                        else if ($(this).attr("name") == "isreturncustomer") {
                            isreturncustomer = this.value;
                        }
                        else if ($(this).attr("name") == "isreturntoprovider") {
                            isreturntoprovider = this.value;
                        }
                        else if ($(this).attr("name") == "comment") {
                            comment = this.value;
                        }
                    });
 
                    parameters.push({
                        OrderLineId: orderlineid,
                        ReturnedQuantity: returnedquantity,
                        Complet: complet,
                        OutOfOrder: outoforder,
                        IsReturnCustomer: isreturncustomer,
                        IsReturnToProvider: isreturntoprovider,
                        Comment: comment
                    });
                });
 
                $.ajax({
                    url: this.action,
                    type: this.method,
                    data: { productModel: JSON.stringify(parameters) },
                    contentType: 'application/json; charset=utf-8',
                    success: function (result) {
                        alert("succes");
                    },
                    error: function (request) {
                        alert("error");
                    }
                });
            });
 
 
        });
Mon problème, je passe toujours dans le error de l'Ajax.

Au final, j'aimerai que mon contrôleur récupère les données dans
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
        [HttpPost, ValidateAntiForgeryToken]
        public ActionResult Details(IList<ReturnProductPostViewModel> productModel)
        {...}