I want to retrieve the session value and pass that value as required parameter for the api. My session is $_SESSION['name']
. And these are my codes
var uniqueName = **Here I want to retrieve session value**;
if(**Then I want to check if uniqueName is null or undefined**) {
$.ajax({
url: 'http://api/check.php',
type: 'GET',
crossDomain: true,
dataType:'json',
data: {
name: uniqueName
},
success: function(result) {
alert("Success");
},
error: function(result) {
alert("Error");
}
});
}
return false;
});