jquery then

I have recently optimized the front end and took a look at jquery then

Found a little better packaged. 

$.ajax({url:'Abc',success:function(data){
    console.log(data);
}}).then(function(data){
    console.log("then="+data);
    return $.ajax({url:'Aaa',success:function(data){
         return data;
    }})
}).then(function(data){
    console.log("then3="+data);
}).done(function(data){
    console.log("done="+data);
}).then(function(data){
    console.log("then4="+data);
})

That is to say, you don't need to call the sublayer, you can use the chain structure, which is very convenient.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325016264&siteId=291194637