adspace
Given a string=”me,I,myself”; .Using javascript only create
an array out of this string and then send a POST request to
the url “record.php” without reloading the page. The post
key parameters should be n1,n2 and n3 respectively.
Answer Posted / Devesh Kumar
First, create an array from the given string: let arr = ["me", "I", "myself"]. Then, use the Fetch API to send a POST request to the specified URL with the appropriate key parameters.nnHere's an example using Promises:nnlet data = {"n1": arr[0], "n2": arr[1], "n3": arr[2]};nfetch("record.php", {n method: 'POST',n headers: {n 'Content-Type': 'application/json'n },n body: JSON.stringify(data)n})
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
No New Questions to Answer in this Category !! You can
Post New Questions
Answer Questions in Different Category