var HTML = ''; //记录添加的 tr id var n = 0; //记录途径顺序 var m = 1; window.onload = function(){ } function saveInfo(){ var add_station_res_id = $('#hyk_res_id').attr("value"); var add_station_res_name = $('#hyk_res_name').attr("value"); var add_station_res_zwmc = $('#hyk_zwmc').attr("value"); var add_station_res_zwjc = $('#hyk_zwjc').attr("value"); var add_station_jindu = $('#hyk_jindu').attr("value"); var add_station_weidu = $('#hyk_weidu').attr("value"); var add_station_station_type = $('#hyk_station_type').attr("value"); var urlStr = ''; var checkportUrl = ''; //遍历所有的tr var trCount = $('#line_list_info').children().length; if (trCount==1) { alert('无相关的站点信息,无法保存!'); return; } for (var k = 1; k < trCount; k++) { var seltr = $('#line_list_info').children(k); var selid = seltr[k].id; $('#orderid'+selid).html(k); //取出要传的数据 var updown = $('#station_type'+selid).val(); var order = $('#orderid'+selid).text(); var time = $('#time_out'+selid).val(); if (time=="") { time = 0; } if ($('#teller'+selid).text()=="-") { checkportUrl = 0; }else{ checkportUrl = $('#teller_station'+selid).val(); } var station = $('#hideid'+selid).val(); var poi = $('#select_poi'+selid).val(); if ((poi=='')||(poi==null)) { poi = 0; } urlStr = urlStr +'{'+updown+','+order+','+time+','+checkportUrl+','+station+','+poi+'}'; } // var saleStyle_company = $('#company input[name="saleStyle_company"]:checked ').val(); var lineStyle = $("input[name='bar_style']:checked").val(); $.ajax({ url:'./st-xm/Model/linemanager/add_station.php', //请求地址 type: "post", data:{ station_res_id=add_station_res_id; station_res_name=add_station_res_name; station_zwmc=add_station_res_zwmc; station_zwjc=add_station_res_zwjc; station_jindu=add_station_jindu; station_weidu=add_station_weidu; station_type=add_station_station_type; }, async:false, dataType: "json", success: function (data) { console.log(data); if(data.code == 0){ alert('保存成功!'); window.location.href="search_line.html" } }, fail: function (data) { alert('保存失败'); } }); }