Question One: I have been struggling to find a way to update a JSON file using the HTTP POST method when both files are stored on the same server (e.g. Godaddy or AWS). While I am able to send data to the server successfully, the JSON file is not being updated. I suspect that I might be overlooking something crucial here. Could it possibly be related to the Godaddy API? Below are the relevant sections of my code:
Question Two: Is there a method to implement authentication for the HTTP request? For example, allowing only authorized users with proper credentials to submit the data change request.
Below is the HTML code snippet:
<body>
<button id="my-button">Click Me</button>
<script>
document.getElementById('my-button').addEventListener('click', dataRequest);
function dataRequest (){
var xhttp = new XMLHttpRequest();
xhttp.open('POST','my-data.json', true);
xhttp.send('Name=YOYO&PhoneNumber=777-777-7777');
}
</script>
The content of my-data.json is as follows:
{ "Name" : "First Name Last Name",
"PhoneNumber" : "888-777-9999" }
Thank you everyone for your assistance