$(function () { var shanxiArr = []; $.ajax({ url: 'city.php', type: 'get', dataType: 'json', }) .done(function(data) { $.each(data, function(i, province) { var provinceName = i.substring(0,2); var province_pinyin = ConvertPinyin(provinceName); if ("shanxi" == province_pinyin) { shanxiArr.push(province_pinyin); console.log(shanxiArr); } // console.log(province_pinyin); var h3Item = "<li class='fl'> <a href='http://www.reading-china.com/"+province_pinyin+"' target='_blank' rel='external nofollow'>"+province_name+"</a> </li>"; $('#cheng_shi').append(h3Item); }); }) .fail(function() { console.log("error"); }); })
我想取出shanxi添加到数组,然后把数组[1]==shanxixi,可是我遍历出来的怎么是循环了两遍?我怎么把陕西的拼音改成shanxixi ?
呼如林
相关分类