jquery如何使用多个ajax调用一个结束后的另一个

我在移动应用程序,我使用多个ajax电话从网络服务器接收数据,如下所示
function get_json() {
    $(document).ready(function() {
        $.ajax({
            url: 'http://www.xxxxxxxxxxxxx',data: {
                name: 'xxxxxx'
            },dataType: 'jsonp',//jsonp: 'callback',//jsonpCallback: 'jsonpCallback',success: function(data) {
                $.each(data.posts,function(i,post) {
                    $.mobile.notesdb.transaction(function(t) {
                        t.executesql('INSERT into bill (barcode,buildingcode,buildingaddress,flatname,flatdescription,entryseason,period,amount,pastpayments,todaypayments,paydate,receiptno) VALUES (?,?,?);',[post.Id,post.Code,post.Address,post.Name,post.Description,post.EntrySeason,post.Period,post.Revenue,post.PastPayments,post.todaypayments,post.paydate,post.receiptno],//$.mobile.changePage('#page3','slide',false,true),null);
                    });
                    $('#mycontent').append(post.Name);
                });
            }
        });

        $.ajax({
            xxxx
        });

        $.ajax({
            xxxx
        });
    });
}

在第二次结束之后,如何强制第二次ajax调用开始之后…第三次,然后继续

thx提前为你的时间

解决方法

将它们放在成功之中:它所依赖的一个
$.ajax({
    url: 'http://www.xxxxxxxxxxxxx',data: {name: 'xxxxxx'},success: function(data){

        // do stuff

        // call next ajax function
        $.ajax({ xxx });
    }
});

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...