I am getting value through post method when i am add it into variable it is showing the same value but when i accessing the value from the outside. it showing me undefined.
var Trends =this.$elm.data('title.poshytip');
var value;
var path = window.location.pathname;
var name = path.substring(path.lastIndexOf('/') + 1);
var dataToSend='{ID:"'+Trends+'"}';
$.ajax({
type: "POST",
url: "UnitedStatesTrends.aspx/serverside",
data: dataToSend,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function( data )
{
value = data.d;
},
error: function() {
alert('error');
}
})
//here
alert(value);
// here i am getting value=undefined in alert but my value is 'UnitedStates'
this.$inner.append(
typeof content == 'function' ?
content.call(this.$elm[0], function(newContent) {
self.update(newContent);
}) :
//here i am setting the value to tooltip
content == '[title]' ? value : content
);