I have a requirement to pass the JavaScript object to a PHP file and load that PHP file in browser when a button is clicked.
index.html has the following code:
<button id="1a" type="button">Click here</button>
custom.js has the following code:
var testobject={'element1':1, 'element2':2}
$(document).ready(function() {
$("#123456").click(function(event){
$.post(
"test.php",
testobject
);
});
But I don't know to write a php file to receive this data. Also I am not able to understand how to load this PHP file.