Есть такой Ajax запрос:
$.ajax({
type: "POST",
data: {'request':1},
url: "/json.php",
dataType: "json",
success: function(data){
var t = data.data;
}
});
console.log(t);
var t;
$.ajax({
type: "POST",
data: {'request':1},
url: "/json.php",
dataType: "json",
success: function(data){
t = data.data;
}
});
console.log(t);
var t;
$.ajax({
type: "POST",
data: {'request':1},
url: "/json.php",
dataType: "json",
success: function(data){
t = data.data;
callback();
}
});
function callback () {
console.log(t);
}
var obj = {
t: null
}
var $deffered = $.ajax({
type: "POST",
data: {'request':1},
url: "/json.php",
dataType: "json",
});
$deffered.done(function(data){
obj.t = data.data;
});
$.ajax({
type: "POST",
data: {'request':1},
url: "/json.php",
dataType: "json",
success: function(data){
var t = data.data;
console.log('Huge success! ', t);
}
});