Am working with Forge UI Kits for jira. Am trying to send data to server via Axios. When I run the code it displays error
Something went wrong
There was an error invoking the function - XMLHttpRequest is not defined
ReferenceError: XMLHttpRequest is not defined
at dispatchXhrRequest (index.js:13394:19)
at new Promise (<anonymous>)
at xhrAdapter (index.js:13386:10)
at dispatchRequest (index.js:31534:10)
at async Object.onSubmita [as onSubmit] (index.js:13795:17)
at async index.js:30340:13
at async asyncMap (index.js:30322:24)
at async index.js:30343:29
at async asyncMap (index.js:30322:24)
at async index.js:30343:29
This is the code
import api, { route } from "@forge/api";
import ForgeUI, { render, Fragment, Text, IssuePanel,Button, ButtonSet, useProductContext, useState, Component, useEffect, ConfigForm, Form, Option, Select, TextArea, TextField,UserPicker, RadioGroup, Radio} from "@forge/ui";
import axios from 'axios';
const App = () => {
const [formState, setFormState] = useState(undefined);
const onSubmita = async (formData) => {
const payload = { name: 'John Doe', title: 'gardener'};
const res = await axios.post('https://mysite.com/db/airmeal.php', payload);
const data = res.data;
console.log(data);
setFormState(formData);
};
onSubmita().then(() => console.log('success'));