I was looking over the web how to send Java script array, like this one:
var array = ["thing1", "thing2", "thing3"];"
To php file on my server.
Then I came across jQuery .post()
method, but when I use it my php file remains empty!
The code I was using is:
var array = ["thing1", "thing2", "thing3"];
$(document).ready(function() {
$.post( 'hs.php', array, function(data, statusText) {
alert("Uploaded")
});
})
But I have no much experience with php and I don't know should php be empty or have some code to retrieve array! All I want is to store javascript array on server file so I can read that array again on page load.
What am I doing wrong?
Can someone show short example of working html and php code?