首页 > 代码库 > Ajax嵌套调用 (jquery) $.ajaxSettings.async = false;
Ajax嵌套调用 (jquery) $.ajaxSettings.async = false;
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src=http://www.mamicode.com/"../javascripts/jquery-2.1.4.js"></script> <script> window.onload = function () { $.post("Handler.ashx", { flag: 1 }, function (_data) { if (_data) { var html = ""; html += "<table border=‘1‘>"; for (var i = 0; i < _data.length; i++) { var pj00401 = _data[i].pj00401; html += "<tr>"; html += "<td>" + _data[i].pj00402 + "</td>"; html += "<td>" + getHtml(pj00401) + "</td>"; html += "</tr>"; } html += "</table>"; $("#div1").append(html); } }, "json"); var getHtml = function (_pj00401) { var _html = ""; $.ajaxSettings.async = false;//重要设置 $.get("Handler.ashx", { flag: 102, pj00401: _pj00401 }, function (_data) { if (_data) { _html = "<table>"; _html += "<tbody> "; for (var i = 0; i < _data.length; i++) { _html += "<tr>"; _html += "<td>" + _data[i].pj00402 + "</td>"; _html += "</tr>"; } _html += "</tbody>"; _html += "</table>"; } }, "json"); return _html; } } </script></head><body> <div id="div1"></div></body></html>
Ajax嵌套调用 (jquery) $.ajaxSettings.async = false;
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。