R
R
Ramil2020-10-22 10:16:31
JSON
Ramil, 2020-10-22 10:16:31

How to initiate an http request (flask, requests, json) on button click?

1) There is a JSON format request in body.

POST api/entrepreneur/create
{
"last_name": "Galyamov",
"first_name": "Ramil",
"middle_name": "Sergeevich",
"birthed": "1997-10-12",
"snils": "161- 456-257 59",
"inn": "772792475156"
}

2) In Flask, I made a button on the page
5f913283cdfaa378259363.png

Question: how to make it so that when I click on the button, I sent an http request to the server with data in jSON format?

Those. make an analogue of the Send button in Postman
5f913692966e6879878255.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2020-11-16
@2ord

Take an HTML form, fill in the data. Write a form handler in JS, in which, when you click on Submit, form it into an object that sends an AJAX request in a serialized form using JSON.stringify().

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question