Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // отправка коментария
- async function sendRequstComent(body, headers) {
- try{
- let response = await fetch('coment.php', {
- method: 'POST',
- body: JSON.stringify(body),
- headers: headers,
- });
- let data = await response.json();
- } catch (e) {
- console.error(e);
- }
- }
- // отправка коментария
- let inputComent = formComent[2]
- inputComent.addEventListener('click', (headers) => {
- let body = {
- 'userName': formComent.username.value,
- 'coment': formComent.coment.value
- };
- sendRequstComent(body, headers).then(console.log(data));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement