I want to pass path
variable from js to plus-page.php
and then go to that page.
$("#btnpage").click(function(){
path = $('#spantwrap').html();
console.log(path); // works, that's a simple html code.
$.ajax({
url: 'plus-page.php',
type: 'post',
data: {'path': path},
success: function() {
console.log(path);
}
});
location.href = 'plus-page.php';
});
plus-page.php
<form id="form1" action="?" method="post">
<input type="hidden" name="path" value="<?php echo $_POST['path'];?>" // line 46
</form>
Error: Undefined index: path on line 46...