var key_word = ""; var area_type = "all"; var type_null = ""; //页面加载 window.onload = function() { // eg:打字太快 如黄 // 黄的数据先出来,拼音的后出来就没有显示 $('#key_word').on('input', function(e) { $("#btn_cancel").css("color", "#0076ff"); key_word = $(this).val(); //var url=test_api+"zz_wxsct/control.php"; var url = "./weixin2t_test/jiekou_test.php"; var parm = { type: "bus_area_list", area: key_word, area_type: type_null } ZZLog(url + JSON.stringify(parm)); // $.post(url,parm,function(res_data){ // res_data=JSON.parse(res_data); // ZZLog(res_data); // if(res_data["code"]!="0"){ // alert(res_data["info"]); // return; // } // //将下拉列表展示出来 // $(".select_xiala").css('z-index','999'); // var list=res_data['list']; // var HTML=""; // for (var i=0,m=list.length;i'+dict['area_name']+'' // } // $(".select_xiala").html(HTML); // }); var res_data = { code: 0, info: "数据返回成功", list: [{ area_id: 791, area_name: "上海市", type: "area" }, { area_id: 3240, area_name: "上海市迪士尼", type: "area" }, { area_id: "9258", area_name: "上海浦东临港开元大酒店", type: "res" }, { area_id: 9, area_name: "人民广场上车点", type: "res" }] } // function(res_data) { // res_data = JSON.parse(res_data); ZZLog(res_data); if(res_data["code"] != "0") { alert(res_data["info"]); return; } //将下拉列表展示出来 $(".select_xiala").css('z-index', '999'); var list = res_data['list']; var HTML = ""; for(var i = 0, m = list.length; i < m; i++) { var dict = list[i]; HTML += '
' + dict['area_name'] + '
' } $(".select_xiala").html(HTML); // } }); //取消 $('#btn_cancel').on('click', function(e) { $('#key_word').val(''); $(".select_xiala").css('z-index', '-1'); $(".select_xiala").html(''); $("#btn_cancel").css("color", "#FFF"); }); } function click_select_area(self_id) { var self_obj = $('#' + self_id); var area_name = self_obj.attr('area_name'); var area_id = self_obj.attr('area_id'); var data = getStorJson('pick_drop'); //拿到缓存 var type = getStorJson('type'); //接机还是送机 var are_type = getPar('area_type'); //判断是查站点还是机场 window.location.href = listURL; }