Hey guys so I am trying to have a JSON send over a value to another page in wordpress to create a session once a image is clicked on.
Here is the JSON code:
$('.item-post a').click(function() {
var prodname = $('#hiddenpostitle');
$.post('/overviewcheck-515adfzx8522',
{
'ProdName': prodname.val()
},
function(response) {
},
'json'
);
});
The #hiddenposttitle is the following: <?php echo "<input type='hidden' value='$title' id='hiddenpostitle' name='hiddenpostitle'/> "?>
So this sends to the overviewcheck page, which then has a template that has the follow:
<?php
/*
Template Name: overviewbackcheck
*/
session_start();
$prodname= $_POST['ProdName'];
$_SESSION['overviewprod'] = $prodname;
?>
Someone mentioned something about wordpress destroying sessions from calling session_start() but that's not the issue because I fixed that awhile ago, and have other sessions being made that work. It has to do something with the JSOn sending over and I am not to sure.
From here the overview page is opened with the following:
$(function()
{
$('.item-post a').colorbox({opacity:0.3, href:"../overviewa512454dzdtfa"});
});
This is the colorbox code that will open the file the within the file I have:
<?php echo $_SESSION['overviewprod']; ?>
to echo it out.
Ultimately I am unable to echo out a session and it does not seem anything is being made.
If you could help me out that would be awesome because I need this finished! :)