Comment: Ajax added Assign javascript variable to php variable and post it on another page
I use the Fullcalendar (javascript). When you click on the event it opens a form with its content.
eventClick: function(calEvent, jsEvent, view) {
content.val(calEvent.content); //content of event
$('#event').show();
formOpen('edit');
},
I want to do that when you click on the event its opens another php page and displayed its data in it.I want to post value through the session,but i dont know how to assign javascript variable to php variable.
eventClick: function(calEvent, jsEvent, view) {
var content = content.val();
<?php
print <<<HERE
location.href = 'anotherpage.php?id=$_SESSION[id]';
HERE;
?>
<?php
$content = content;
$_SESSION['content'] = $content;
?>
},
P.S: ajax did not work because it seems that i have a bit of a particular situation.
$.ajax({
type: "POST",
url: "anotherpage.php",
data: {content: content.val()},
});
Anotherpage.php
<?php
$content = $_POST['content'];
?>