添加红色部分代码即可解决问题
$(function(){$(".apply_button").click(function( event){
var topicId = $(this).attr("id");
$.ajax({
type : "POST",
url : "topic/topicAction!isBusy",
data : "topicId=" + topicId,
dataType : "json",
success : function(msg2) {
//alert(msg2.studentId);
if(msg2.studentId != null){
event.preventDefault();//阻止原有链接跳转
alert('Tip:课题已经被选,请选择其他。');
$(location).attr('href','<%=basePath%>teacher/teacherAction!queryAll');//跳转到新的地址
}
}
});
});
});