<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Aja.js異步JS和JSON數(shù)據(jù)請求

          聯(lián)合創(chuàng)作 · 2023-09-22 04:58

          aja.js 主要用于異步JS文件和JSON數(shù)據(jù)的請求,不支持XML請求。

          Npm Downloads

          JSON 數(shù)據(jù)請求

            aja()
              .url('/api/data.json')
              .on('success', function(data){
                  //data is a JavaScript object
              })
              .go();

          請求載入 HTML

            aja()
              .url('/views/page.html')
              .into('.container')
              .go();

          REST 客戶端

            aja()
              .method('GET')
              .url('/api/customer')
              .timeout(2500)
              .data({firstname: 'John Romuald'})
              .on('200', function(response){
                  //well done
              })
              .on('timeout', functon(){
                  // uh oh... Request ended. Do something fancy here, don't let your user wait forever!
              })
              .go();
          
            aja()
              .method('PUT')
              .url('/api/customer')
              .cache(false)
              .body({id : 12, firstname: 'John Romuald', job : 'linguist'})
              .on('200', function(response){
                  //well done
              })
              .on('40x', function(response){
                  //something is definitely wrong
              })
              .on('500', function(response){
                  //oh crap
              })
              .go();

          JSON

            aja()
              .url('http://otherdomain.com/api/remoteScript')
              .type('jsonp')
              .jsonPaddingName('callbackParameter')
              .jsonPadding('someGlobalFunction')
              .on('success', function(data){
                  //Fuk cross origin policy
              })
              .go();

          載入JS

              aja()
                .url('http://platform.twitter.com/widgets.js')
                .type('script')
                .on('success', function(){
                    window.twttr.widgets.load();
                })
                .go();
          瀏覽 14
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  日本免费成人撸一区二区三区 | 久久久久麻豆 | 日天天天天日 | 欧美成人性爱视频在线播放 | 午夜丁香网 |