var left=$('.left p');
left.click(function(){
var index= $(this).index('.left p');
var returned_data= ajaxcall(click_name);
console.log(returned_data)
});
function ajaxcall(name)
{
$.ajax({
type: "POST",
url: "retriveData.php",
data:{click: name},
cache: false,
success: function(data)
{
var p=data;
return p;
}
})
}
I need the value in variable p to be passed to click function variable returned_data. But the returned_data is showing undefined. Can you please tell me what is wrong with the code here