I am facing an issue with adding data to a *.JSON file. Despite receiving a "success" message from Ajax, the file remains unchanged. I have also noticed that when the JSON file is empty, nothing happens at all. Can someone help me find a solution? I'm struggling to locate the source of the problem. Any insight into other possible causes would be greatly appreciated. Thank you.
Here is the ajax code snippet:
$.ajax({
type: "POST",
url: "data/test.json",
data: JSON.stringify({ "userName": "1", "password" : "1" }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data){alert("success");},
fail: function(errMsg) {alert("fail");
}
});