function videoTimetion(){
var videotie=-1;
//我取到的页面时间,然后将年月日拼接成一个字符串
var dates=document.getElementById("startDate").value;
var StartTime=document.getElementById("startHour").value;
var startmin=document.getElementById("startMinute").value;
var videoconfer=dates+" "+StartTime+":"+startmin+":"+"00";
alert(videoconfer);
$.ajax({
url:'<%=request.getContextPath()%>/videoconf.do?method=getVideoconfer&',传入这个方法中
type:'POST',
data:{depId:videoconfer},值
async: false,
success:function(msg) { videotie = msg;
if(videotie>=0){
validate();
}
else{
alert("您还没有带规定的时间");
}
}
});
}
这个方法是我从数据库取出的时间进行比较
public int getVideoconfer(String videoStarttime) {
PrintWriter out =null;
int result = -1;
String dateTime = conferenceService.qryDataTime();
int loctime = Integer.parseInt(conferenceService.qryVideoTime());
Calendar c = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
c.setTime(format.parse(dateTime));
c.add(Calendar.MINUTE, loctime);
String videocinfer = format.format(c.getTime());
将页面传入的值跟我从数据库计算的值比较,如果大于1和0就是在规定的时间,现在我应该怎么把result 传入页面,让页面mag能取到这个值啊?请高手指点,谢谢
result = videoStarttime.compareTo(videocinfer);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return -1;
------解决方案--------------------
response.getWriter.print();往前台写,如果要写对明,可以用JSONObject JSONArray
------解决方案--------------------
JSONObject
------解决方案--------------------
恩,建议同上!支持一下