I have been through a ton of other posts and cannot figure out how to do this.
AJAX:
$.ajax({
type: 'POST',
url: 'getSessionVariable.php',
contentType: 'application/json',
dataType: 'json',
success: function(data) {
alert(data);
},
error:function(data){
alert("error occured"); //===Show Error Message====
alert(data);
}
});
PHP:
<?
session_start();
print_r(json_encode($_SESSION["Variable"]));
?>
This solution returns "error Occurred"
Second Ajax statement:
jQuery.ajax({
type:'POST',
url: 'getSessionVariable.php',
contentType: 'json',
success:function(data){
alert("Sucess!");
alert(data);
},
error:function(data){
alert("error occured"); //===Show Error Message====
// alert(data);
}
});
The second AJAX solution runs successfully but returns the entire php page back, I am just looking for the session variable to be returned...