<tfoot id='xiAE2'></tfoot>

    • <bdo id='xiAE2'></bdo><ul id='xiAE2'></ul>

  1. <i id='xiAE2'><tr id='xiAE2'><dt id='xiAE2'><q id='xiAE2'><span id='xiAE2'><b id='xiAE2'><form id='xiAE2'><ins id='xiAE2'></ins><ul id='xiAE2'></ul><sub id='xiAE2'></sub></form><legend id='xiAE2'></legend><bdo id='xiAE2'><pre id='xiAE2'><center id='xiAE2'></center></pre></bdo></b><th id='xiAE2'></th></span></q></dt></tr></i><div id='xiAE2'><tfoot id='xiAE2'></tfoot><dl id='xiAE2'><fieldset id='xiAE2'></fieldset></dl></div>
  2. <legend id='xiAE2'><style id='xiAE2'><dir id='xiAE2'><q id='xiAE2'></q></dir></style></legend>

      <small id='xiAE2'></small><noframes id='xiAE2'>

      jquery嵌套ajax调用格式化

      时间:2023-05-29
      <tfoot id='1O8J6'></tfoot>

        <bdo id='1O8J6'></bdo><ul id='1O8J6'></ul>
            <tbody id='1O8J6'></tbody>
            <i id='1O8J6'><tr id='1O8J6'><dt id='1O8J6'><q id='1O8J6'><span id='1O8J6'><b id='1O8J6'><form id='1O8J6'><ins id='1O8J6'></ins><ul id='1O8J6'></ul><sub id='1O8J6'></sub></form><legend id='1O8J6'></legend><bdo id='1O8J6'><pre id='1O8J6'><center id='1O8J6'></center></pre></bdo></b><th id='1O8J6'></th></span></q></dt></tr></i><div id='1O8J6'><tfoot id='1O8J6'></tfoot><dl id='1O8J6'><fieldset id='1O8J6'></fieldset></dl></div>
          • <small id='1O8J6'></small><noframes id='1O8J6'>

            <legend id='1O8J6'><style id='1O8J6'><dir id='1O8J6'><q id='1O8J6'></q></dir></style></legend>
              • 本文介绍了jquery嵌套ajax调用格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我需要根据上一次调用的数据连续进行 6 次 ajax 调用.我将每个调用嵌套在上一个调用的成功中.我的问题是有什么好的方法来格式化代码,这样它就不会在我的编辑器中出现一百万行?

                I have a requirement to make 6 ajax calls in succession based on data from the previous call. I am nesting each call in the success of the previous call. my question is what are some good ways to format the code so that it doesnt end up a million rows across my editor?

                 $.ajax({
                                type: "POST",
                                url: "someScript/someScript.php",
                                data: form + "&func=build",
                                success: function (result) {
                                 if (result == "ok")
                                 {
                                   $.ajax({
                                   type: "POST",
                                   url: "someScript/someScript.php",
                                   data: form + "&func=someOtherFunc",
                                   success: function (result) {
                                        if (result == "ok")
                                        {
                                          $.ajax({
                                           type: "POST",
                                           url: "someScript/someScript.php",
                                           data: form + "&func=someOtherFunc",
                                           success: function (result) {
                                           if (result == "ok")
                                           {
                                             .....and so on
                                           }
                                           })
                                         }
                                      })
                                    })
                                   }
                                 })
                

                忽略括号,语法对于这个问题并不重要.

                ignore brackets, syntax isnt important for this question.

                推荐答案

                你可以这样做

                function ajaxCall1(){
                    $.ajax({
                        success: function(){
                            ajaxCall2();
                        }
                    });
                }
                function ajaxCall2(){
                    $.ajax({
                        success: function(){
                            ajaxCall3();
                        }
                    });
                }
                function ajaxCall3(){
                    $.ajax({
                        success: function(){
                            ajaxCall4();
                        }
                    });
                }
                

                这篇关于jquery嵌套ajax调用格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:使用纯 JavaScript 将电话号码格式化为用户类型 下一篇:Javascript:格式化数字的更简单方法?

                相关文章

                最新文章

                  <bdo id='1vjKc'></bdo><ul id='1vjKc'></ul>
              • <legend id='1vjKc'><style id='1vjKc'><dir id='1vjKc'><q id='1vjKc'></q></dir></style></legend>

                    <tfoot id='1vjKc'></tfoot>

                    <small id='1vjKc'></small><noframes id='1vjKc'>

                  1. <i id='1vjKc'><tr id='1vjKc'><dt id='1vjKc'><q id='1vjKc'><span id='1vjKc'><b id='1vjKc'><form id='1vjKc'><ins id='1vjKc'></ins><ul id='1vjKc'></ul><sub id='1vjKc'></sub></form><legend id='1vjKc'></legend><bdo id='1vjKc'><pre id='1vjKc'><center id='1vjKc'></center></pre></bdo></b><th id='1vjKc'></th></span></q></dt></tr></i><div id='1vjKc'><tfoot id='1vjKc'></tfoot><dl id='1vjKc'><fieldset id='1vjKc'></fieldset></dl></div>