function update(days){
var content1 = ['<REQUEST>',
'<HEAD>',
'<YWBH>getDoctInfo</YWBH>',
'</HEAD>',
'<DATA>',
'<KSDM>49</KSDM>',
'<YYRQ>2017-08-18</YYRQ>',
'</DATA>',
'</REQUEST>',
].join("");
$.ajax({
type:"post",
url:"。。。。。。。。。.php",
dataType:"json",
data:{content:JSON.stringify(content1)},
success:function(xml){
var xmlContent = $.parseXML(xml);
var $xml = $(xmlContent).children().children();
var arr1 = [];
for (var i=0;i<$xml.length;i++) {
var Up = $xml[i].children;
var times = Up[2].innerHTML;
var myDate = new Date(times);
var out = myDate.getFullYear() + "-" + (parseInt(myDate.getMonth()) + 1) + "-" + ((myDate.getDate() > 9) ? myDate.getDate() : "0" + myDate.getDate());
if(out==days){
var upJSON = {
pbksid:Up[0].innerHTML,
pbks:Up[1].innerHTML,//科室
column1:Up[2].innerHTML,//时间
ysid:Up[3].innerHTML,
ysxm:Up[4].innerHTML,//医生姓名
zzjbid:Up[5].innerHTML,
zzjb:Up[6].innerHTML,//级别名称
kghs:Up[7].innerHTML,//可挂号数
ghf:Up[8].innerHTML//挂号费
}
arr1.push(upJSON);
}
}
$("#nav").html(template("symbol-nav",arr1));
},
error:function(){
console.log("失败");
}
});
var content2 = ['<REQUEST>',
'<HEAD>',
'<YWBH>getScheInfo</YWBH>',
'</HEAD>',
'<DATA>',
'<KSDM>49</KSDM>',
'<YSDM>94</YSDM>',
'<StartDate>2017-8-18</StartDate>',
'<EndDate>2017-8-18</EndDate>',
'</DATA>',
'</REQUEST>',
].join("");
$.ajax({
type:"post",
url:"。。。。。。。.php",
dataType:"json",
data:{content:JSON.stringify(content2)},
success:function(xml){
var xmlContent = $.parseXML(xml);
var $xml = $(xmlContent).children().children();
var arr1 = [];
for (var i=0;i<$xml.length;i++) {
var Up = $xml[i].children;
var schedulingJSON = {
timerange:Up[2].innerHTML
}
console.log($xml[i]);
console.log(Up[2].innerHTML);
// arr1.push(schedulingJSON);
}
// $("#nav").html(template("symbol-nav",arr1));
},
error:function(e){
console.log("shibai");
}
});
}
用同一个回调.
太感谢了
用同一个回调就可以了