您的位置:首页 > Web前端 > JQuery

Jquery Deferred 链式

2017-12-02 00:00 10 查看
JQuery Deferred Chain

JQuery Deferred 链式参数参数写要then

$.get("http://localhost/Designer/Handlers/CommonService.ashx")

.then(function(data){

debugger;

return $.get("http://localhost/Designer/Handlers/StepActorConfigActualActor.ashx")

}).then(function(data){

debugger;})






如果你使用done 第二个done 中函数的参数还是第一个done的参数

 $.get("http://localhost/Designer/Handlers/CommonService.ashx")
.done(function(data){
debugger;
return $.get("http://localhost/Designer/Handlers/StepActorConfigActualActor.ashx")
}).done(function(data){
debugger;})






ES5 Promse 链式写法的参数传递

fetch("http://localhost/Designer/Handlers/CommonService.ashx",{credentials: "include"})

.then(function(response){

debugger;

return fetch("http://localhost/Designer/Handlers/StepActorConfigActualActor.ashx",{credentials: "include"})

}).then(function(response){debugger;});






参数 https://stackoverflow.com/questions/17216438/chain-multiple-then-in-jquery-when
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Jquery Promises