window.location.href = "adminindex.html?account=" + account;(前一个网页有的,传过来,名字account)
(function ($) {
$.getUrlParam
= function (name) {
var reg
= new RegExp("(^|&)" +
name + "=([^&]*)(&|$)");
var r
= window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
})(jQuery);
var teacherAccount = $.getUrlParam("account");
$.ajax({
url:URL + "searchCourseList.json",
method:"post",
dataType:"json",
success:function(returnData) {
var result = returnData;
if (result.code == SUCCESS_CODE) {
var con = "";
$.each(result.data, function (i, item) {
con += '<tr><label><input type="checkbox"></label><td>"+item.name+"</td>';
con += "<td>"+item.teachername+"</td>";
con += "<td>"+item.classroom+"</td>";
con += '<td><input class="btn btn-default" type="submit" value="确认"></td></tr>';
});
console.log(con);
$("#courseList").html(con);
}
alert("received JSON:" + JSON.stringify(data));
},
error:function() {
alert("error");
}
});
给动态生成的绑定事件
$("容器").delegate('目标','事件',function() {});
$("#optCourese").delegate('.delete','click',function() {})