婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > ajax請(qǐng)求json數(shù)據(jù)案例詳解

ajax請(qǐng)求json數(shù)據(jù)案例詳解

熱門(mén)標(biāo)簽:外呼系統(tǒng)獲取客戶(hù)手機(jī)號(hào) 老虎郵局地圖標(biāo)注點(diǎn) 科智聯(lián)智能電銷(xiāo)機(jī)器人 徐州電銷(xiāo)卡外呼系統(tǒng)供應(yīng)商 目標(biāo)三維地圖標(biāo)注 上海浦東百度地圖標(biāo)注中心注冊(cè) 襄陽(yáng)外呼系統(tǒng)接口 青海醫(yī)療智能外呼系統(tǒng)怎么樣 百靈鳥(niǎo)

今天有這樣一個(gè)需求,點(diǎn)擊六個(gè)大洲,出現(xiàn)對(duì)應(yīng)的一些請(qǐng)求信息,展示在下面,請(qǐng)求請(qǐng)求過(guò)后,第二次點(diǎn)擊就無(wú)需請(qǐng)求。
如圖所示:點(diǎn)擊北美洲下面出現(xiàn)請(qǐng)求的一些數(shù)據(jù)

html代碼結(jié)構(gòu):

div class="conSixmap">
  div class="name conmap01" data-name="beimeizhou">
    a href="javascript:void(0)">北美洲/a>
    div class="condetail">/div>
  /div>
  div class="name conmap02" data-name="nanmeizhou">
    a href="javascript:void(0)">南美洲/a>
    div class="condetail">/div>
  /div>
  div class="name conmap03" data-name="ouzhou">
    a href="javascript:void(0)">歐洲/a>
    div class="condetail">/div>
  /div>
  div class="name conmap04" data-name="feizhou">
    a href="javascript:void(0)">非洲/a>
    div class="condetail">/div>
  /div>
  div class="name conmap05" data-name="yazhou">
    a href="javascript:void(0)">亞洲/a>
    div class="condetail">/div>
  /div>
  div class="name conmap06" data-name="dayangzhou">
    a href="javascript:void(0)">大洋洲/a>
    div class="condetail">/div>
  /div>
/div> 

css樣式:

.conSixmap{position:relative;width:678px;height:335px;margin:0 auto;background:url(../images/tuanduimapBg.png) no-repeat;color:#000;font-family:"微軟雅黑"}
.conSixmap .name .condetail{display:none;position:absolute;z-index:10;width:216px;padding:10px;left:50%;margin-left:-118px;top:54px;background:url(../images/opcity83.png) repeat;border-radius:5px;}
.conSixmap .condetail span{display:block;color:#fff;font-size:14px;text-align:left;}
.conSixmap .name{position:absolute;width:52px;height:55px;}
.conSixmap .name a{display:block;z-index:2;position:absolute;padding-top:35px;text-align:center;cursor:pointer;width:52px;height:20px;color:#000;font-size:12px;}
.conSixmap .conmap01{left:91px;top:73px;}
.conSixmap .conmap01 a{background:url(../images/beimeipicBg.png) no-repeat top center;}
.conSixmap .conmap02 {left:180px;top:213px;}
.conSixmap .conmap02 a{background:url(../images/nanmeimapbg.png) no-repeat top center;}
.conSixmap .conmap03 {left:339px;top:68px;}
.conSixmap .conmap03 a{background:url(../images/ouzhoumapBg.png) no-repeat top center;}
.conSixmap .conmap04{left:327px;top:158px;}
.conSixmap .conmap04 a{background:url(../images/feizhoumapbg.png) no-repeat top center;}
.conSixmap .conmap05 {left:480px;top:75px;}
.conSixmap .conmap05 a{background:url(../images/yazhoumapBg.png) no-repeat top center;}
.conSixmap .conmap06 {left:545px;top:220px;}
.conSixmap .conmap06 a{background:url(../images/dayangmapbg.png) no-repeat top center;}

json格式:

{
  "beimeizhou": [
    "請(qǐng)求的json數(shù)據(jù)1",
    "請(qǐng)求的json數(shù)據(jù)2"
  ],
  "nanmeizhou": [
    "請(qǐng)求的json數(shù)據(jù)3",
    "請(qǐng)求的json數(shù)據(jù)4"
  ],
  "ouzhou": [
    "請(qǐng)求的json數(shù)據(jù)5",
    "請(qǐng)求的json數(shù)據(jù)6",
    "請(qǐng)求的json數(shù)據(jù)7",
    "請(qǐng)求的json數(shù)據(jù)8"
  ],
  "feizhou": [
    "請(qǐng)求的json數(shù)據(jù)9",
    "請(qǐng)求的json數(shù)據(jù)10",
    "請(qǐng)求的json數(shù)據(jù)11",
    "請(qǐng)求的json數(shù)據(jù)12"
  ],
  "yazhou": [
    "請(qǐng)求的json數(shù)據(jù)13",
    "請(qǐng)求的json數(shù)據(jù)14"
  ],
  "dayangzhou": [
    "請(qǐng)求的json數(shù)據(jù)15",
    "請(qǐng)求的json數(shù)據(jù)16"
  ]
}

js代碼:

$(document).ready(function(){
  //添加地圖
  var stauteArr={
      'beimeizhou':'true',
      'nanmeizhou':'true',
      'ouzhou':'true',
      'feizhou':'true',
      'yazhou':'true',
      'dayangzhou':'true'
    };
  $(".conSixmap .name").on('click',function(){
    var _this=this;
    var htmlcon="";
    $(this).siblings(".name").children(".condetail").fadeOut(500);
    $(this).children(".condetail").fadeIn(500);
    var _name=$(this).attr('data-name');
     $.ajax({
      url:"js/schoolMap.json",
      type:'get',
      data:{},
      dataType:"json",
      success: function(data){
        for(var i in data){
          if(_name==i  stauteArr[i]=='true'){
            for(var j=0;jdata[i].length;j++){
               htmlcon+="span>"+data[i][j]+"/span>";
            }
            $(_this).children(".condetail").append(htmlcon);
            stauteArr[i]='false';
          }
        }
      },
      error: function(){
        alert('請(qǐng)求失敗,請(qǐng)檢查網(wǎng)絡(luò)');
      }
    });
  });
});

您可能感興趣的文章:
  • php處理json格式數(shù)據(jù)經(jīng)典案例總結(jié)
  • AngularJs解決跨域問(wèn)題案例詳解(簡(jiǎn)單方法)
  • BootStrap的JS插件之輪播效果案例詳解
  • JSP自定義標(biāo)簽案例分析
  • AngularJS實(shí)現(xiàn)元素顯示和隱藏的幾個(gè)案例
  • JavaScript多圖片上傳案例
  • JS案例分享之金額小寫(xiě)轉(zhuǎn)大寫(xiě)
  • js對(duì)象轉(zhuǎn)json數(shù)組的簡(jiǎn)單實(shí)現(xiàn)案例
  • Ajax $.getJSON案例詳解
  • javascript的理解及經(jīng)典案例分析

標(biāo)簽:佛山 股票 商洛 辛集 荊州 揭陽(yáng) 紅河 咸寧

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ajax請(qǐng)求json數(shù)據(jù)案例詳解》,本文關(guān)鍵詞  ajax,請(qǐng)求,json,數(shù)據(jù),案例,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ajax請(qǐng)求json數(shù)據(jù)案例詳解》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于ajax請(qǐng)求json數(shù)據(jù)案例詳解的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 和平区| 灌阳县| 青岛市| 康平县| 宜黄县| 南通市| 集安市| 治多县| 常熟市| 霍城县| 临沧市| 泾川县| 新蔡县| 莱芜市| 万州区| 那坡县| 房山区| 新建县| 增城市| 衡水市| 栖霞市| 东明县| 宜川县| 麻栗坡县| 金乡县| 江油市| 桂平市| 定结县| 大方县| 仪陇县| 井陉县| 武宣县| 专栏| 扬中市| 平乡县| 全椒县| 江陵县| 那曲县| 红安县| 淮北市| 安庆市|