ajax 函數外調用

來源:互聯網
上載者:User

標籤:val   col   font   erro   text   .ajax   logs   url   nbsp   

 1 <html data-dpr="1" style="font-size: 50px;"> 2  3 <head> 4  5 <script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script> 6 </head> 7  8 <body style=""> 9 10 <script type="text/javascript">11 var id = "123";12 $.ajax({13 url: ‘http://ai2800.com/api.php/Goods/type_goods/type/xsgss‘,14 type: ‘post‘,15 dataType: "json",16 // data:{wurl:w_url,murl:m_url}, 17 async: false,18 error: function() {},19 success: function(data) {20 id = data;21 console.log(id)22 23 }24 })25 26 console.log(id);27 </script>28 29  30 31 32 <script type="text/javascript">33 function load(val) {34 $.ajax({35 url: ‘http://ai2800.com/api.php/Goods/type_goods/type/xsgss‘,36 type: ‘post‘,37 dataType: "json",38 // data:{wurl:w_url,murl:m_url}, 39 async: false,40 error: function() {},41 success: function(dat) {42 id = dat;43 val(dat)44 45 }46 })47 }48 load(function(data) {49 console.log(data)50 })51 </script>52 53 54 <script type="text/javascript">55 function s() {56 var id57 $.ajax({58 url: ‘http://ai2800.com/api.php/Goods/type_goods/type/xsgss‘,59 type: ‘post‘,60 dataType: "json",61 async: false,62 error: function() {},63 success: function(dat) {64 id = dat;65 }66 })67 return id;68 }69 var b = s()70 console.log(b)71 </script>72 73 74 <script type="text/javascript">75 var id76 $.ajax({77 url: ‘http://ai2800.com/api.php/Goods/type_goods/type/xsgss‘,78 type: ‘post‘,79 dataType: "json",80 async: false,81 error: function() {},82 success: function(dat) {83 var id = dat;84 bb()85 }86 })87 88 function bb() {89 console.log(id)90 }91 </script>92 93 </body>94 95 </html>

 

ajax 函數外調用

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.