function getOnline() {
	$
			.ajax( {
				url : "asks",
				type : "post",
				dataType : "json",
				success : function(json) {
					$("#online").empty();
					$("#online").append(json.al[0] + "<br/>");
					var types = json.al[1];
					if (types == "0") {
						if (json.al[1] == "online-text") {
							$("#online")
									.append(
											"&nbsp;&nbsp;<input type='text' name='tk' id='tk'>");
						} else {
							if (json.al[2] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='checkbox' name='c1' id='c1' value='a'>"
												+ json.al[2] + "<br/>");
							}
							if (json.al[3] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='checkbox' name='c1' id='c1' value='b'>"
												+ json.al[3] + "<br/>");
							}
							if (json.al[4] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='checkbox' name='c1' id='c1' value='c'>"
												+ json.al[4] + "<br/>");
							}
							if (json.al[5] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='checkbox' name='c1' id='c1' value='d'>"
												+ json.al[5]);
							}
						}
					} else {
						if (json.al[1] == "online-text") {
							$("#online")
									.append(
											"&nbsp;&nbsp;<input type='text' name='tk' id='tk'><br/>");
						} else {
							if (json.al[2] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='radio' name='c1' id='c1' value='a'>"
												+ json.al[2] + "<br/>");
							}
							if (json.al[3] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='radio' name='c1' id='c1' value='b'>"
												+ json.al[3] + "<br/>");
							}
							if (json.al[4] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='radio' name='c1' id='c1' value='c'>"
												+ json.al[4] + "<br/>");
							}
							if (json.al[5] != null) {
								$("#online").append(
										"&nbsp;&nbsp;<input type='radio' name='c1' id='c1' value='d'>"
												+ json.al[5]);
							}
						}
					}
					$("#online")
							.append(
									"<div style='text-align: center'><input type='button' value='提交' onclick='subOn()'></div>");
				},
				error : function() {
				//	$("#online").html("数据库连接错误");
				}
			});
}
function subOn() {
	var temp = document.getElementsByName("c1");
	var tk = document.getElementsByName("tk").value;
	for ( var i = 0; i < temp.length; i++) {
		if (temp[i].checked)
			var c1 = temp[i].value;
	}
	if (c1 == null && tk == null) {
		alert("请认真填写问卷调查！");
	} else {
		$
				.ajax( {
					url : "onlineAnswer",
					type : "post",
					data : "c1=" + c1 + "&tk=" + tk,
					dataType : "json",
					success : function(json) {
						$("#online").empty();
						$("#online")
								.append(
										"<div style='vertical-align: middle;text-align: center;width=100%;hight=100%'>感谢您的参与!</div>");
					},
					error : function() {
				//		$("#online").append("数据库连接失败！");
					}
				});
	}
}
