To communicate between javascript (which runs on the client machine’s browser) and PHP (which runs on your server) you need to use ajax. Since you are already using jQuery, I suggest using their abstraction method $.ajax()
. It would look something like this:
// post value of #progressbar id to my php page
$.ajax({
url: myPHPPage.php,
data: JSON.stringify({ progressbarID: '#progressbar' }),
success: function (dataFromServer) {
alert('it worked!');
},
error: function (jqXHR) {
alert('something went horribly wrong!');
}
});
solved How to pass a value from javascript function? [duplicate]