I have written a POST and GET function in javascript to send comments from input and to retrieve stored comments whenever the page is loaded. However I don't know how to handle the data that I send, how do I handle it after the data is sent to save it and then on a later point be able to access it again after a reload? So in short, send comments to server, then retrieve them on a new pageload.
I was thinking of making a storage.php file where I would handle the data and then put it to a file, but i'm not quite sure how it would work.
Here are the POST and GET functions:
self.getEntries=function(){
$.ajax({
type:"GET",
url:"storage.php",
dataType:'json',
data: jsonData,
success: function(data){
vm.comments=data.comments;
}
});
}
self.sendEntry=function(){
$.ajax({
type:"POST",
url:"storage.php",
dataType:'json',
data: jsonData
});
var jsonData=ko.toJSON(ViewModel);
Any help or examples would be very helpful! Thanks in advance. :)