I am having trouble understanding the following code:
var x = $.ajax({
url : "sample_url",
dataType : "json",
data : {
"invalidate_cache" : true
}
});
Now, if I do
var y = x.then();
It returns the same function as x. Also what would have been different if x had been assigned the following way (Apart from "Hello 1" getting printed during ajax success return):
var x = $.ajax({
url : "sample_url",
dataType : "json",
data : {
"invalidate_cache" : true
}
}).then(function(data){console.log("Hello 1")};