Bonjour et merci d'avance,
Je n'arrive pas à savoir comment récupérer chaque forme envoyé en ajax dans un dict dans ma vue. c'est vraiment frustrant ...
Code JS fonction Ajax
Code JavaScript : 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 function calculate_implantation() { var form_project = $('.form_project').serialize(); var form_roof = $('.form_roof').serialize(); var form_implantation = $('.form_implantation').serialize(); $.ajax({ data: { "project": form_project, "roof": form_roof, "implantation": form_implantation }, type: "POST", url: '/calcul_implantation/', success: function (response) {} }); // }).done(draw()); };
Ma vue :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 def calcul_implantation(request): if request.method == "POST": project = ProjectForm(request.POST) roof = RoofForm(request.POST) implantation = ImplantationForm(request.POST) try: if project.is_valid(): if roof.is_valid(): if implantation.is_valid():
Partager