What if the ajax is requested every three seconds, causing the page to stutter every three seconds?

how do I optimize the code?

function football_exponent_ajax() {
    $.ajax({
      url: urlName + "/v1/football/oddslive",
      success: function(res) {
        let findUpDown = $(".f-w10").find("span");
        findUpDown.each(function(){
            $(this).removeClass("up down");
        })
        
        if(res.result!=null){
            for(key in res.result){
                
                let oddArr = res.result[key];
                
                oddArr[0][0][1] = oddsConvert(oddArr[0][0][1]);
                if(oddArr[1]){
                    oddArr[1][0][1] = oddsConvert(oddArr[1][0][1]);
                    if(oddArr[1][0][3]==1){
                        oddArr[1][0][0] = "";
                        oddArr[1][0][1] = "";
                        oddArr[1][0][2] = "";
                        oddArr[1][0][4] = "no";
                        oddArr[1][0][5] = "no";
                        oddArr[1][0][6] = "no";
                    }
                    if(oddArr[1][1][3]==1){
                        oddArr[1][1][0] = "";
                        oddArr[1][1][1] = "";
                        oddArr[1][1][2] = "";
                        oddArr[1][1][4] = "no";
                        oddArr[1][1][5] = "no";
                        oddArr[1][1][6] = "no";
                    }
                    if(oddArr[1][2][3]==1){
                        oddArr[1][2][0] = "";
                        oddArr[1][2][1] = "";
                        oddArr[1][2][2] = "";
                        oddArr[1][2][4] = "no";
                        oddArr[1][2][5] = "no";
                        oddArr[1][2][6] = "no";
                    }
                }
                if(oddArr[2]){
                    oddArr[2][0][1] = oddsConvert(oddArr[2][0][1]);
                    if(oddArr[2][0][3]==1){
                        oddArr[2][0][0] = "";
                        oddArr[2][0][1] = "";
                        oddArr[2][0][2] = "";
                        oddArr[2][0][4] = "no";
                        oddArr[2][0][5] = "no";
                        oddArr[2][0][6] = "no";
                    }
                    if(oddArr[2][1][3]==1){
                        oddArr[2][1][0] = "";
                        oddArr[2][1][1] = "";
                        oddArr[2][1][2] = "";
                        oddArr[2][1][4] = "no";
                        oddArr[2][1][5] = "no";
                        oddArr[2][1][6] = "no";
                    }
                    if(oddArr[2][2][3]==1){
                        oddArr[2][2][0] = "";
                        oddArr[2][2][1] = "";
                        oddArr[2][2][2] = "";
                        oddArr[2][2][4] = "no";
                        oddArr[2][2][5] = "no";
                        oddArr[2][2][6] = "no";
                    }
                }

                if(!oddArr[0][0]){
                    oddArr[0][0] = ["","",""]
                }
                if(!oddArr[0][1]){
                    oddArr[0][1] = ["","",""]
                }
                if(!oddArr[0][2]){
                    oddArr[0][2] = ["","",""]
                }
                if(!oddArr[1][0]){
                    oddArr[1][0] = ["","",""]
                }
                if(!oddArr[1][1]){
                    oddArr[1][1] = ["","",""]
                }
                if(!oddArr[1][2]){
                    oddArr[1][2] = ["","",""]
                }
            if(oddArr[2]){
                if(!oddArr[2][0]){
                    oddArr[2][0] = ["","",""]
                }
                if(!oddArr[2][1]){
                    oddArr[2][1] = ["","",""]
                }
                if(!oddArr[2][2]){
                    oddArr[2][2] = ["","",""]
                }
              
              $("li[data-id="" + key + ""] .f-w10 .odds-out").html(
                  `
                  <div class="w-left">
                        <span class="r-one iconfont `+oddArr[2][0][4]+`">`+oddArr[2][0][0]+`</span>
                        <span class="r-two iconfont `+oddArr[2][2][4]+`">`+oddArr[2][2][0]+`</span>
                    </div>
                    <div class="w-middle">
                        <span class="rangqiu_key iconfont `+oddArr[2][0][5]+`">`+oddArr[2][0][1]+`</span>
                        <span class="daxiao_key iconfont `+oddArr[2][2][5]+`">`+oddArr[2][2][1]+`</span>
                    </div>
                    <div class="w-right">
                        <span class="r-one iconfont `+oddArr[2][0][6]+`">`+oddArr[2][0][2]+`</span>
                        <span class="r-two iconfont `+oddArr[2][2][6]+`">`+oddArr[2][2][2]+`</span>
                    </div>
                  `
              );
              //odds-box
              $("li[data-id="" + key + ""] .f-w10 .odds-box .rows-second").html(
                  `
                  <div class="column-one w-one">
                      <div class="c-rows-up h-up"></div>
                      <div class="c-rows-down h-down"></div>
                      <div class="c-rows-down h-down"></div>
                  </div>
                  <div class="column-two w-two">
                      <div class="c-rows-up h-up">
                          <span>`+oddArr[0][0][0]+`</span>
                          <span>`+oddArr[0][0][1]+`</span>
                          <span>`+oddArr[0][0][2]+`</span>
                      </div>
                      <div class="c-rows-down h-down">
                          <span>`+oddArr[1][0][0]+`</span>
                          <span>`+oddArr[1][0][1]+`</span>
                          <span>`+oddArr[1][0][2]+`</span>
                      </div>
                      <div class="c-rows-down h-down">
                      <span>`+oddArr[2][0][0]+`</span>
                      <span>`+oddArr[2][0][1]+`</span>
                      <span>`+oddArr[2][0][2]+`</span>
                  </div>
                  </div>
                  <div class="column-three w-three">
                      <div class="c-rows-up h-up">
                          <span>`+oddArr[0][1][0]+`</span>
                          <span>`+oddArr[0][1][1]+`</span>
                          <span>`+oddArr[0][1][2]+`</span>
                      </div>
                      <div class="c-rows-down h-down">
                          <span>`+oddArr[1][1][0]+`</span>
                          <span>`+oddArr[1][1][1]+`</span>
                          <span>`+oddArr[1][1][2]+`</span>
                      </div>
                      <div class="c-rows-down h-down">
                          <span>`+oddArr[2][1][0]+`</span>
                          <span>`+oddArr[2][1][1]+`</span>
                          <span>`+oddArr[2][1][2]+`</span>
                      </div>
                  </div>
                  <div class="column-four w-four">
                      <div class="c-rows-up h-up">
                          <span>`+oddArr[0][2][0]+`</span>
                          <span>`+oddArr[0][2][1]+`</span>
                          <span>`+oddArr[0][2][2]+`</span>
                      </div>
                      <div class="c-rows-down h-down">
                          <span>`+oddArr[1][2][0]+`</span>
                          <span>`+oddArr[1][2][1]+`</span>
                          <span>`+oddArr[1][2][2]+`</span>
                      </div>
                      <div class="c-rows-down h-down">
                          <span>`+oddArr[2][2][0]+`</span>
                          <span>`+oddArr[2][2][1]+`</span>
                          <span>`+oddArr[2][2][2]+`</span>
                      </div>
                  </div>
                  `
                )
            }else{
            
            $("li[data-id="" + key + ""] .f-w10 .odds-out").html(
              `
                <div class="w-left">
                    <span class="r-one `+oddArr[1][0][4]+`">`+oddArr[1][0][0]+`</span>
                    <span class="r-two `+oddArr[1][2][4]+`">`+oddArr[1][2][0]+`</span>
                </div>
                <div class="w-middle">
                    <span class="rangqiu_key `+oddArr[1][0][5]+`">`+oddArr[1][0][1]+`</span>
                    <span class="daxiao_key `+oddArr[1][2][5]+`">`+oddArr[1][2][1]+`</span>
                </div>
                <div class="w-right">
                    <span class="r-one `+oddArr[1][0][6]+`">`+oddArr[1][0][2]+`</span>
                    <span class="r-two `+oddArr[1][2][6]+`">`+oddArr[1][2][2]+`</span>
                </div>
              `
            );
           
            $("li[data-id="" + key + ""] .f-w10 .odds-box .rows-second").html(
              `
              <div class="column-one w-one">
                  <div class="c-rows-up h-up"></div>
                  <div class="c-rows-down h-down"></div>
                  <div class="c-rows-down h-down"></div>
              </div>
              <div class="column-two w-two">
                  <div class="c-rows-up h-up">
                      <span>`+oddArr[0][0][0]+`</span>
                      <span>`+oddArr[0][0][1]+`</span>
                      <span>`+oddArr[0][0][2]+`</span>
                  </div>
                  <div class="c-rows-down h-down">
                      <span>`+oddArr[1][0][0]+`</span>
                      <span>`+oddArr[1][0][1]+`</span>
                      <span>`+oddArr[1][0][2]+`</span>
                  </div>
              </div>
              <div class="column-three w-three">
                  <div class="c-rows-up h-up">
                      <span>`+oddArr[0][1][0]+`</span>
                      <span>`+oddArr[0][1][1]+`</span>
                      <span>`+oddArr[0][1][2]+`</span>
                  </div>
                  <div class="c-rows-down h-down">
                      <span>`+oddArr[1][1][0]+`</span>
                      <span>`+oddArr[1][1][1]+`</span>
                      <span>`+oddArr[1][1][2]+`</span>
                  </div>
              </div>
              <div class="column-four w-four">
                  <div class="c-rows-up h-up">
                      <span>`+oddArr[0][2][0]+`</span>
                      <span>`+oddArr[0][2][1]+`</span>
                      <span>`+oddArr[0][2][2]+`</span>
                  </div>
                  <div class="c-rows-down h-down">
                      <span>`+oddArr[1][2][0]+`</span>
                      <span>`+oddArr[1][2][1]+`</span>
                      <span>`+oddArr[1][2][2]+`</span>
                  </div>
              </div>
              `
            )
            }
          }
        }
        
      }
    });
}

The

code can't be seen. Isn't this a loop? Optimize yourself first, these five or six articles.

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5a89b-455d8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5a89b-455d8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?