
河北农业大学就业管理系统
//在前端使用jquery获取表单数据
//$(function (){
//$("#login").on("click","a",function () {
//var d = {};
//var data = $("form").serializeArray();//可以获取表单中的所有数据
//$.each(data, function () {
//d[this.name] = this.value;
//});
//console.log(JSON.stringify(d));//返回的是json串
//});
//});
//==================================================================================
//$(document).ready(function () {
//$(‘#login‘).on(‘click‘, ‘a‘, function () {
//var aVal = $(‘.identifire select‘);
//if (aVal.val() == ‘学生‘) {
//$(this).attr(‘href‘, ‘StudentIndex.html‘);
//} else if (aVal.val() == ‘教师教辅人员‘) {
//$(this).attr(‘href‘, ‘TeacherIndex.html‘);
//}
//});
//});
//jquery使用ajax请求5步操作:get请求
//$(function (){
// $("#login").on("click","a",function (){
// //1、创建异步对象
//var ajaxObj = new XMLHttpRequest();
//var url = "/ashx/Login.ashx?usAccount=" + $("#usAccount").val() + "&usPwd=" + $("#usPwd").val();
2、设置请求参数:
// ajaxObj.open("get",url,true);
3、发送求情
//ajaxObj.send();
4、注册事件
//ajaxObj.onreadystatechange = function(){
// if (ajaxObj.status == 200 && ajaxObj.readyState==4){
//alert("返回成功!");
//console.log(ajaxObj.responseText);
//}
//}
//});
//});
//jquery使用ajax请求5步操作:post请求
// $(function () {
// $("#login").on("click", "a", function () {
// //1、创建异步对象
// var ajaxObj = new XMLHttpRequest();
// //2、设置请求参数:
//ajaxObj.open("post", "/ashx/Login.ashx", true);
//ajaxObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// //3、发送求情
//ajaxObj.send("usAccount=" + $("#usAccount").val() + " &usPwd=" + $("#usPwd").val());
// //4、注册事件
// ajaxObj.onreadystatechange = function () {
// if (ajaxObj.status == 200 && ajaxObj.readyState == 4) {
// alert("返回成功!");
// console.log(ajaxObj.responseText);
// }
// }
// });
// });
//$(function () {
// $("#login").on("click", "a", function () {
// var name = $("#usAccount").val();
// if (name == "") {
// alert("请输入账号!");
// return false;
// }
// else {
// //async: true 异步请求 get
// //checkName(name);
// //async: true 异步请求 post
// //checkName(name);
// //async: true 同步请求 get
// checkName(name);
// return true;
// }
// });
//});
//function checkName(name) {
// //ajax异步请求五步操作
// var ajaxObj = new XMLHttpRequest();
// ajaxObj.open("post", "/ashx/Login.ashx?name="+name, true);
// ajaxObj.send();
// ajaxObj.onreadystatechange=function(){
// if (ajaxObj.status == 200 && ajaxObj.readyState==4) {
// alert(ajaxObj.responseText);
// }
// }
//}
//同步get请求
//function checkName(name) {
// var ajaxObj = new XMLHttpRequest();
// ajaxObj.open("get", "/ashx/Login.ashx?name=" + name, false);
// ajaxObj.send();
// alert(ajaxObj.responseText);
//}
//同步post请求
//function checkName(name) {
// var ajaxObj = new XMLHttpRequest();
// ajaxObj.open("post", "/ashx/Login.ashx?name=" + name, false);
// ajaxObj.send();
// alert(ajaxObj.responseText);
//}
//登录验证
$(function () {
$("#login").on("click", "a", function () {
var xhr = new XMLHttpRequest();
xhr.open("post", "/ashx/Login.ashx", true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send("usAccount=" + $("#usAccount").val() + "&usPwd=" + $("#usPwd").val() + "&role=" + $("#role").val());
xhr.onreadystatechange = function () {
if (xhr.status == 200 && xhr.readyState == 4) {
window.location = "../html/StudentInfo.html";
}
}
});
});